OAuth2SchemeBuilder.AuthorizationUrl() incorrectly parses OAuth2 auth url with Azure AD B2C signin policy
See original GitHub issuewhen using Azure AD B2C, the OAuth2 authorization url is something like:
https://login.microsoftonline.com/mytenant.onmicrosoft.com/oauth2/v2.0/authorize?p=b2c_1_mysigninpolicy
note that this authorization url has a query parameter that indicates the B2C policy to use
when using this url with OAuth2SchemeBuilder.AuthorizationUrl() then in Swagger UI the completed authorization url becomes:
https://login.microsoftonline.com/mytenant.onmicrosoft.com/oauth2/v2.0/authorize?p=b2c_1_mysigninpolicy?response_type=token&redirect_uri=....
notice the double appearance of a question mark: apparently the code doesn’t properly parse the provided authorization url, but just blindly appends a new question mark and further querystring parameters
this breaks authentication with a 404 not found
the correct composed url should instead be:
https://login.microsoftonline.com/mytenant.onmicrosoft.com/oauth2/v2.0/authorize?p=b2c_1_mysigninpolicy&response_type=token&redirect_uri=....
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
is there an example for setting up Azure AD B2C with swashbuckle on .NET core?
@markti I just found this article which helped my out.