Better Auth Microsoft OAuth - email_not_found Error
Hi team! I'm having an issue with Better Auth and Microsoft OAuth integration. When trying to authenticate with Microsoft, I'm getting this error:
"Better Auth Error: We encountered an issue while processing your request.
Error Code: email_not_found"
My setup:
"Better Auth Error: We encountered an issue while processing your request.
Error Code: email_not_found"
My setup:
- Microsoft Azure app with these permissions: User.Read, Mail.Send, Mail.Read, Mail.ReadWrite, Calendars.Read, Calendars.ReadWrite, Contacts.Read, etc.
- Client secret is valid and working
- Redirect URIs should be correct
- Using the standard OAuth flow with these scopes in auth.ts:
- I also tried both formats for scopes:
- Short format: "Mail.Send", "User.Read"
- Long format: "https://graph.microsoft.com/Mail.Send"
- Are these the correct Microsoft scopes for Better Auth to extract email?
- Does Better Auth need specific fields from Microsoft's response?
- How does Better Auth extract email from Microsoft's response? Does it look for "mail" or "userPrincipalName"?
- Any known issues with Microsoft OAuth in Better Auth?


