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

PathTemplate auth/token hardcoded in OAuth2Client ExchangeTokenAsync method #30

Open
stefanmilivojevic91 opened this issue Aug 31, 2023 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@stefanmilivojevic91
Copy link

stefanmilivojevic91 commented Aug 31, 2023

Token endpoint path should be fetched from issuer's openid configuration (.well-known/openid-configuration) endpoint. AzureAD has oauth2/token for instance and OAuth2Client is unable to fetch access token using client credentials flow (FgaApiNotFoundError exception is thrown).
https://github.com/openfga/dotnet-sdk/blob/main/src/OpenFga.Sdk/ApiClient/OAuth2Client.cs#L122

@rhamzeh
Copy link
Member

rhamzeh commented Aug 31, 2023

Thanks for raising the issue @stefanmilivojevic91 !

@rhamzeh
Copy link
Member

rhamzeh commented Sep 5, 2023

@stefanmilivojevic91 if we allowed you to specify the token endpoint itself, will that be enough to resolve your issue?

Basically, if you set ApiTokenIssuer with a path, we will no longer append /oauth/token.

So:

ApiTokenIssuer Endpoint SDK will hit
issuer.fga.example https://issuer.fga.example/oauth/token
https://issuer.fga.example https://issuer.fga.example/oauth/token
issuer.fga.example/some_endpoint https://issuer.fga.example/some_endpoint
https://issuer.fga.example/some_endpoint https://issuer.fga.example/some_endpoint

@stefanmilivojevic91
Copy link
Author

@rhamzeh My apologies for the delayed response, I think that will do the job, thanks :)

@mdimovskihtec
Copy link

@rhamzeh Hi, maybe allow overriding of the endpoint? That should allow for more customization, because I think it does not cover the case for oauth2 endpoints. For example, the oauth2 endpoint in Azure is oauth2/v2.0/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
Projects
Status: Backlog
Development

No branches or pull requests

3 participants