juhanakristian / remix-auth-microsoft

Microsoft authentication strategy for remix-auth
MIT License
37 stars 19 forks source link

fix: prompt should be optional to avoid interrupting SSO #35

Open robert-bo-davis opened 1 month ago

robert-bo-davis commented 1 month ago

This is probably not safe to merge immediately into the 2.x version since it will change the default behavior, but after banging my head against why I couldn't get the "normal" auth flow to work in a downstream fork, I found that prompt is being set to "none" by default.

prompt is an optional attribute. Defaulting to "none" prevents the default SSO flow from taking place if the user isn't logged in or hasn't authenticated the app. If it is undefined then the "normal" flow happens: MS figures out if they are logged in and if they have granted consent and handles prompting as needed.

See: https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow

Screenshot 2024-06-16 at 10 39 49 AM

For anyone else who runs into this issue, you can override back to the default SSO flow by setting prompt to an empty string so the ?? doesn't catch, but that seems pretty clunky.