Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sign-in does not check authorization-server code_challenges_supported #11967

Open
ap0nia opened this issue Oct 4, 2024 · 0 comments
Open

sign-in does not check authorization-server code_challenges_supported #11967

ap0nia opened this issue Oct 4, 2024 · 0 comments
Labels
bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@ap0nia
Copy link

ap0nia commented Oct 4, 2024

Environment

N/A

Reproduction URL

https://github.com/ap0nia/next-auth

Describe the issue

Summary
The getAuthorizationUrl function does not take into account the code_challenges_supported for OIDC providers.

Details
The code block here initializes a local variable as that gets assigned to instead of the as at the outer scope, defined here. This means that the check for as.code_challenges_supported will never execute here.

How to reproduce

  1. Import MicrosoftEntraId provider.
  2. Set clientId, clientSecret, tenantId.
  3. Login with MicrosoftEntraId.
  4. It works, but it shouldn't.

Microsoft Entra's OIDC discovery endpoint does not return a code_challenges_supported array, but it's supposed to return ['pkce'] because it's actually required.

Expected behavior

If the code logic is correct, then Microsoft Entra should actually throw an error upon login, because they do not return code_challenges_supported from their discovery endpoint, despite requiring it to login.

Ideally, both scenarios could co-exist - Microsoft Entra's discovery endpoint not matching the specification, but Auth.js still being able to handle the edge case somehow.

I think my solution would be to provide an authorizationServer to the OIDC config, where settings can be provided manually to "patch" non-compliant discovery endpoints.

@ap0nia ap0nia added bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

1 participant