question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OAuth2SchemeBuilder.AuthorizationUrl() incorrectly parses OAuth2 auth url with Azure AD B2C signin policy

See original GitHub issue

when 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:closed
  • Created 7 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
markticommented, Oct 9, 2017

is there an example for setting up Azure AD B2C with swashbuckle on .NET core?

0reactions
ChiefWiggumcommented, Nov 22, 2017

@markti I just found this article which helped my out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OAuth2SchemeBuilder.AuthorizationUrl( ...
OAuth2SchemeBuilder.AuthorizationUrl() incorrectly parses OAuth2 auth url with Azure AD B2C signin policy #896.
Read more >
having an issue with Azure AD B2C sign in/set up
I have created an ADB2C tenant directory, and I have created the test application. The sign in link seems to be fine. Then...
Read more >
Authorization code flow - Azure Active Directory B2C
Learn how to set up the resource owner password credentials (ROPC) flow in Azure Active Directory B2C.
Read more >
Enable web app authentication options using Azure Active ...
This article describes how to enable, customize, and enhance the Azure Active Directory B2C (Azure AD B2C) authentication experience for ...
Read more >
Microsoft identity platform and OAuth 2.0 authorization ...
The OAuth 2.0 authorization code grant type, or auth code flow, ... Azure AD can't find it, or it's not correctly configured.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found