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

Use token-endpoint instead of issuer for oauth2 authorization #136

Open
1 task done
c-thiel opened this issue Sep 25, 2024 · 3 comments
Open
1 task done

Use token-endpoint instead of issuer for oauth2 authorization #136

c-thiel opened this issue Sep 25, 2024 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest

Comments

@c-thiel
Copy link

c-thiel commented Sep 25, 2024

Checklist

Describe the problem you'd like to have solved

Some IdPs do not use /oauth/token as a suffix for an oauth2 (not oauth!) token exchange.
Entra-id for example uses /oauth2/v2.0/token even though the old /oauth/token endpoint is still supported for backwards compatibility.

We currently cannot specify these endpoint as the suffix is hard coded:

token_url = f"https://{configuration.api_issuer}/oauth/token"

Describe the ideal solution

Use either a /.well-known/openid-configuration to determine the token endpoint, or, maybe easier, allow users to specify the token endpoint directly (without suffixing it in the code snippet above).

Alternatives and current workarounds

Switch IdP - bad idea :)

References

No response

Additional context

No response

@c-thiel c-thiel added the enhancement New feature or request label Sep 25, 2024
@rhamzeh
Copy link
Member

rhamzeh commented Sep 28, 2024

We have an issue tracking this here: openfga/sdk-generator#238

If the plan described there is appropriate for you, let us know so that we can update the issue here

@kanishk128
Copy link

Hey @rhamzeh @c-thiel , could this issue be assigned to me? I am thinking of implementing dynamic discovery

@rhamzeh rhamzeh moved this from Backlog to In progress in SDKs and Tooling Oct 21, 2024
@stefan505
Copy link

stefan505 commented Nov 15, 2024

The only way this can be properly solved is to use the well known endpoint of the IDP in question, to correctly discover endpoints for the issuer and token_endpoint, etc. The current implementation doesn't work for Microsoft Entra ID, nor Amazon Cognito for example, for different reasons.

Additionally, the reliance on audience for OIDC client credentials auth doesn't work for Amazon Cognito (as far as I can tell) as it doesn't appear to support audience and there is no aud claim for it in an access token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest
Projects
Status: In progress
Development

No branches or pull requests

4 participants