Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1743

Unable to connect using OIDC workforce authentication on mongosh v2.2.1

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.2.2
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      OS: Linux (Ubuntu 22.04.1)
      node.js / npm versions: Unknown
      Additional info:
    • Iteration Xiaosaurus
    • Not Needed
    • Developer Tools

      Problem Statement/Rationale

      I cannot use workforce authentication on mongosh v2.2.1 (latest)

      Steps to Reproduce

      Attempt to use workforce authentication on mongosh v2.2.1

      Expected Results

      Successful connection. Example (mongosh v2.0.2)

      azure-user@nds-e2e-oidc-vm:~$ mongosh --version
      2.0.2
      azure-user@nds-e2e-oidc-vm:~$ mongosh 'mongodb+srv://cluster0.6aqlu.mmscloudteam.com/admin?authMechanism=MONGODB-OIDC&authSource=%24external&ssl=true' --oidcTrustedEndpoint --oidcFlows=device-auth --quiet --eval 'db.hello()'
      
      Visit the following URL to complete authentication: https://mongodb-dev.okta.com/activate
      Enter the following code on that page: LRGZDWMZ
      Waiting... 

      Actual Results

      Unsuccessful connection

      azure-user@nds-e2e-oidc-vm:~$ mongosh --version
      2.2.1
      azure-user@nds-e2e-oidc-vm:~$ mongosh 'mongodb+srv://cluster0.6aqlu.mmscloudteam.com/admin?authMechanism=MONGODB-OIDC&authSource=%24external&ssl=true' --oidcTrustedEndpoint --oidcFlows=device-auth --quiet --eval 'db.hello()'
      
      Error: Unable to fetch issuer metadata for "https://mongodb-dev.okta.com/oauth2/ausqrxbcr53xakaRR357": (intermediate value).discover is not a function 

      Additional Notes

      I suspect this is due to a library mongosh uses for OIDC. I'm not sure the details for my systems node installation, I basically just launched a new ubuntu VM and installed mongosh.

      azure-user@nds-e2e-oidc-vm:~$ uname -svp Linux #16~22.04.1-Ubuntu SMP Fri Feb 16 15:42:02 UTC 2024 x86_64 

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            brad.bentz@mongodb.com Brad Bentz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: