auth
auth copied to clipboard
Error getting user email from external provider only with public Azure /consumers/ tenant
Bug report
- [x] I confirm this is a bug with Supabase, not with my own application.
- [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
When using oauth with Azure and the personal accounts only tenant, the oauth call does not work and the error Error getting user email from external provider
happens everytime.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Setup an oauth call with MSFT. When you set it up, ensure your app registration is
Personal accounts only
- As per supabase documentation and microsoft's, use
https://login.microsoftonline.com/consumers/
as the tenant URL - Ensure
email
is added in the scope as per the docs, like:
async function signInWithAzure() {
const { data, error } = await supabase.auth.signInWithOAuth({
provider: 'azure',
options: {
scopes: 'email',
},
})
}
Expected behavior
This should work
System information
- OS: Windows and hosted
- Browser all
- Version of supabase-js: 2.39.3
- Version of Node.js: 20.12.2
Additional context
This appears similar to https://github.com/supabase/auth/issues/550 but in that issue people said personal accounts worked fine, it was /common/
that did not. Now it seems the opposite
Supabase Auth requires that the user have an email address present. Are you sure the user account has one?
Yes I am sure (it's me signing up to test it).
hi @automaton82, if you're still running into this error, please open a ticket at https://supabase.help - it helps us investigate the issue alot more easily since we'll be able to investigate your project's logs.
same issue
i fixed the issue by adding 'scope': 'email' in options, just like official example:
async function signInWithAzure() { const { data, error } = await supabase.auth.signInWithOAuth({ provider: 'azure', options: { scopes: 'email', }, }) }