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

Is it possible to set a discovery URI for API token acquisition? #1212

Closed
jennyf19 opened this issue May 25, 2021 · 2 comments
Closed

Is it possible to set a discovery URI for API token acquisition? #1212

jennyf19 opened this issue May 25, 2021 · 2 comments
Milestone

Comments

@jennyf19
Copy link
Collaborator

Is it possible to set a discovery URI for API token acquisition?

var accessToken = await _tokenAcquisition.GetAccessTokenForAppAsync(scopesToAccessDownstreamApi);

With WebApps, setting the authority along with the tenant, client, and secret configs will send you to the authority for discovery ex:
https://myCustomAuthority/myTenantId/oauth2/v2.0/.well-known/openid-configuration

TokenAcquisition is using:
var builder = ConfidentialClientApplicationBuilder .CreateWithApplicationOptions(_applicationOptions) .WithHttpClientFactory(_httpClientFactory)

var builder = ConfidentialClientApplicationBuilder

Which then creates a new ConfidentialClientApplicationBuilder with an empty ApplicationConfiguration object so the CustomInstanceDiscovery is always null
var config = new ApplicationConfiguration(); var builder = new ConfidentialClientApplicationBuilder(config).WithOptions(options);

https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/blob/ac7541c1aa1c7bdbb20df5c7e72628161f826f44/src/client/Microsoft.Identity.Client/AppConfig/ConfidentialClientApplicationBuilder.cs#L42

This causes GetAccessTokenForAppAsync to always request:
https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=.......%2Fauthorize
Instead of a cached or custom discovery endpoint.

Is this possible or would it be a feature request?

Originally posted by @TLevitt in #1202

@jennyf19 jennyf19 added this to the 1.12.0 milestone May 25, 2021
@jennyf19 jennyf19 modified the milestones: 1.12.0, 1.13.0 May 28, 2021
@jmprieur
Copy link
Collaborator

jmprieur commented Jun 3, 2021

This should be fixed at the same time as #1167

@jennyf19
Copy link
Collaborator Author

believe this is fixed in 1.13 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants