netbirdio / netbird

Connect your devices into a secure WireGuard®-based overlay network with SSO, MFA and granular access controls.
https://netbird.io
BSD 3-Clause "New" or "Revised" License
10.92k stars 494 forks source link

OAuth/ODIC - Azure AD authentication loop - Self-hosted Netbird #814

Open spanishdexter opened 1 year ago

spanishdexter commented 1 year ago

Describe the problem After configuring a self-hosted netbird server with Azure AD OAuth, a login loop occurs when navigating to the netbird web interface. I get re-directed to the Azure AD login page for my Azure AD tenant as expected, authenticate, then get re-directed to Netbird, but then Netbird keeps trying to redirect me back to Azure AD. Azure AD already knows I'm authenticated then redirects me back, this causes a redirect loop over and over until Azure AD times out and throws an error that I could not be logged in.

To Reproduce Steps to reproduce the behavior:

  1. Navigate to your Netbird instance in a browser.
  2. If you configured your setup.env file correctly, you should get re-directed to Azure AD SSO login to provide credentials. Login.
  3. You should be re-directed to Netbird after login, but Netbird keeps re-directing back to Azure AD instead, Azure AD will re-direct back to Netbird because your already logged in, causing a re-direct loop until Azure AD times out and throws a login error.

Expected behavior Navigating to the Netbird web interface on the server should redirect to Azure AD where user login occurs then the user should be re-directed back to the Netbird web console, logged in successfully.

NetBird status -d output: If applicable, add the output of the netbird status -d command. Can't login to my VM from my current location at this time to run this command, I will need to wait until I am home from the office.

Stunt0265 commented 1 year ago

Followed this?

https://github.com/netbirdio/docs/blob/cb03373f8feb9da0204606ab055fa9825f0f9a26/docs/integrations/identity-providers/self-hosted/azure-ad.md

And make sure the to see if this was done: "Modify the api scope within dashboard enviroment variable AUTH_SUPPORTED_SCOPES located in docker-compose.yml to api:///api."

spanishdexter commented 1 year ago

@Stunt0265 OMG thank you!!!

mlsmaycon commented 1 year ago

Hello @Stunt0265 we've updated the documentation and added integration to our management. Check it out here: https://docs.netbird.io/selfhosted/identity-providers#azure-ad