-
Notifications
You must be signed in to change notification settings - Fork 223
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
[Bug] ConsentHandler in MVC Partial View Produces Malformed Redirect Uri #626
Comments
@phil4business, what did you register in your app registration? (https://localhost:37289/ ?) |
Taking this as a P1 to be more robust. |
app registration "replyUrlsWithType": [
{
"url": "https://localhost:37289/signin-oidc",
"type": "Web"
},
{
"url": "http://localhost:37289",
"type": "Web"
},
{
"url": "https://localhost:37289",
"type": "Web"
}
], launchSettings.json "profiles": {
"ServerRequest": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "localhost"
},
"applicationUrl": "https://localhost:37289/"
}
} |
Adjusting launchSettings to have |
We have the same problem with malformed redirect URLs when hosting the blazor (server-side) web app in a directory / virtual path: |
Included in 1.1.0 release. |
Which version of Microsoft Identity Web are you using?
Microsoft Identity Web 1.0.0
Where is the issue?
Is this a new or an existing app?
c. This is a new app or an experiment.
Repro
StartUp.cs
ApiHealthService.cs
_Layout.cshtml
Expected behavior
The user is redirected to the expected page.
Actual behavior
The redirect Uri returned by MicrosoftIdentityConsentAndConditionalAccessHandler.HandleException (non-Blazor) is malformed, containing and extra
/
. E.g.: Attempts to navigate tohttps://localhost:37289
redirects tohttps://localhost:37289//
, navigating tohttps://localhost:37289/VMRequests
redirects tohttps://localhost:37289//VMRequests/
To recreate:
https://localhost:37289
)https://localhost:37289
)https://localhost:37289//
(you can see the request in the debug console. E.g.:https://localhost:37289/MicrosoftIdentity/Account/Challenge?redirectUri=https://localhost:37289//&scope=...
)This also works with an
InMemoryTokenCache
if you leave the browser open but restart the app.Possible solution
Modify
MicrosoftIdentityConsentAndConditionalAccessHandler.HandleException
orMicrosoftIdentityConsentAndConditionalAccessHandler.CreateBaseUri
to not add in extra/
s if they were not present in the originating Uri.The text was updated successfully, but these errors were encountered: