[BUG] AuthorizationCodeCredential does not allow Redirect URI to be defined #21529
Labels
Azure.Identity
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-team-attention
Workflow: This issue needs attention from Azure service team or SDK team
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Describe the bug
When utilizing
AuthorizationCodeCredential
to get an access token, an exception is thrown regarding the reply URL not being set.The reply URL is set on the application registration to match the latter address. I was able to confirm that the portal is configured correctly by using a standard HTTP request on the oauth2 token endpoint - this worked correctly and I received an access token.
Expected behavior
The
AuthorizationCodeCredential
class should allow specification of the reply URL to use for gaining an access token. The documentation for the auth code flow here specifies thatredirect_uri
is a required parameter. Additionally, that documentation is referenced in the Azure SDK for .NET class documentation here.Actual behavior (include Exception or Stack Trace)
To Reproduce
Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)
AuthorizationCodeCredential
Below is the azure function used to test this scenario. The custom
Authorization.GetTokenAsync
function usingHttpClient
works while usingAuthorizationCodeCredential.GetTokenAsync
throws the exception. I navigate tohttp://localhost:7071/api/Authorize
in the browser, which redirects to MSFT authorize endpoint, accept scope, and it redirects tohttp://localhost:7071/api/Redirect
.Environment:
dotnet --info
output for .NET Core projects): Windows 10 .NET Core 3.1The text was updated successfully, but these errors were encountered: