auth: Azure Auth: http://localhost:5000/?error=server_error&error_description=Error+getting+user+email+from+external+provider
Bug report
When I login using Azure Auth for a newly created Azure App Registration, I get this error
To Reproduce
- Register a new app registration in azure portal, giving access to organisations and personal accounts
- Register the supabase redirect uri as a “Web” redirect uri (in azure portal)
- Create a secret for this new app registration
- enable azure auth in supabase, pasting in the client id and secret of the new app registration
- Invoke:
const {user, session, error} = await supabase.auth.signIn({
provider: 'azure',
})
- That calls https://rlgaaitetwbkhisssmkq.supabase.co/auth/v1/authorize?provider=azure
- Which returns with a 302 to https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=16d4a427-b73c-45fc-b04f-9545e7273f21&redirect_uri=https://rlgaaitetwbkhisssmkq.supabase.co/auth/v1/callback&response_type=code&scope=openid&state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJle…
- Which returns with a 200 and pops the Microsoft Auth dialog, asking for me to grant permission to the app. Note, it does not ask me what Microsoft identity to use, I assume its using the identity I am using to log into Azure Portal.
- I grant permission, then it seems to load https://login.live.com/Me.htm?v=3
- Then it seems to load https://login.live.com/oauth20_authorize.srf?client_id=16d4a427-b73c-45fc-b04f-9545e7273f21&scope=openid&redirect_uri=https://rlgaaitetwbkhisssmkq.supabase.co/auth/v1/callback&response_type=code&state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ....&uaid=95c5d4c9a43f406ca88c5b1b22ea432a&msproxy=1&issuer=mso&tenant=common&ui_locales=en-GB
- Then it loads https://account.live.com/Consent/Update?mkt=EN-GB&uiflavor=web&id=293577&ru=https://login.live.com/oauth20_authorize.srf?uaid=95c5d4c9a43f406ca88c5b1b22ea432a&opid=A353DB724539E16F&opidt=1640691597
- Eventually we get to https://login.live.com/oauth20_authorize.srf?uaid=95c5d4c9a43f406ca88c5b1b22ea432a&opid=A353DB724539E16F&opidt=1640691597&res=success&route=R3_BAY
- which returns a 302 to https://rlgaaitetwbkhisssmkq.supabase.co/auth/v1/callback?code=M.R3_BAY.f96be895-105c-c9f1-5462-d0b31af76746&state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ey…
- Invoking https://rlgaaitetwbkhisssmkq.supabase.co/auth/v1/callback?code=M.R3_BAY.f96be895-105c-c9f1-5462-d0b31af76746&state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ey… returns a 302 to http://localhost:5000/?error=server_error&error_description=Error+getting+user+email+from+external+provider
Expected behavior
I have done the same steps for Google Auth, and it worked, expect the same to happen for Azure auth.
Also, I have successfully logged in using Azure using similar steps using the Microsoft Native javascript sdk for auth, @azure/msal-browser
I am aware of https://github.com/supabase/gotrue/pull/54 , but two things on that. The first is: I was not presented with an option to select an email address to login with (presumably because I am already logged into azure portal?) but even if I was, the second point is that I don’t expect my customers to login using this weird azure specific email address. I expect them to login using their “usual” azure identity.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 41 (11 by maintainers)
Reopened, thanks for commenting on this. Looking into it!
As an update, the Auth team are aware and looking into the issue currently; it was not an easy one to reproduce but it is being actively worked on!
HI @dabbijak Thanks for the steps, the
emailscope is already documented in our main docs here. The issue is with AD not returning the email address in the response (unless it has been manually set by the Org owner or the user themselves) as they are not mapped.As this is an AD issue, primarily, I would opt to close this until Microsoft is able to respond with a fix. If people disagree with the decision and want to keep it open, please react with 👎 (to save commenting noise) and we can reopen!
Hey everyone, GoTrue requires that Azure provide back an email address for the user that is signing in. Make sure you always use this code snippet which includes the email scope:
Please reopen the issue if this does not solve the problem for you.
Without any modifications on our end, sign in with Azure is breaking with
?error=server_error&error_code=500&error_description=Error+getting+user+email+from+external+provider- tried everyhing I could think of and all suggestions across this and similar issues, nothing is working so far.@encima the answers here are the same as in our email exchange - same product 😄
Thanks @encima ! This kills Azure signups for us and makes us look quite bad in front of our customers who previously were able to use Azure auth to sign in but now are forced to send magic links as a fall back until this is fixed.
I’m also having this issue and fixe above did not resolve it.
@zomchak-code I’m experiencing the same
@hf You mentioned this issue should be reopened if
scopes: 'email'doesn’t solve the problem.The problem still exists, and can be reproduced. I can see a lot of people experiencing this. Let me know if you can reproduce this and if this issues should be reopened or a new created.
I’m pretty sure I’ve checked everything on the setup side and the access is really in granted, but this error still persists
To reproduce
https://login.microsoftonline.com, NOThttps://login.live.comI have the same issue
Hey so there was a report that on some Azure accounts the email is encoded differently. @silentworks do you recall?
I can confirm that if I log out of Azure portal, I am prompted to enter an email address