Closed tommiie closed 4 years ago
Thanks for contacting us. @javiercn can you please look into this? @tommiie, do you experience the same issue with Blazor WebAssembly 3.2 Preview 5? It actually shipped today!
@tommiie thanks for contacting us.
You need to change the base path in the Index.html
and account for that in the registered redirect url on your AAD application.
@javiercn sorry but it is not working for me. Maybe it is important to know, that I built my app as a PWA. Here is what I tried:
http://localhost:5000/timemanagement-dev
<base href="/timemanagement-dev/" />
"start_url": "/timemanagement-dev/"
"scope": "/timemanagement-dev/"
http://localhost:5000/timemanagement-dev
http://localhost:5000/timemanagement-dev/authentication/login?returnUrl=http%3A%2F%2Flocalhost%3A5000%2Ftimemanagement-dev
System.InvalidOperationException: Invalid return url. The return url needs to have the same origin as the current page.
is thrown in web browser consolehttp://localhost:5000/timemanagement-dev/authentication/login?returnUrl=http%3A%2F%2Flocalhost%3A5000%2Ftimemanagement-dev%2Fauthentication%2Flogin%3FreturnUrl%3Dhttp%253A%252F%252Flocalhost%253A5000%252Ftimemanagement-dev
@javiercn now I found the problem. The exception is correct. The returnUrl is different to the origin. origin: http://localhost:5000/timemanagement-dev/authentication/login returnUrl: http://localhost:5000/timemanagement-dev
I have to add the string /authentication/login
to the navigation url in RedirectToLogin.razor
:
@code {
protected override void OnInitialized()
{
Navigation.NavigateTo($"authentication/login?returnUrl={Uri.EscapeDataString(Navigation.Uri + "/authentication/login")}");
}
}
But I cannot imagine that this should be default behavior/solution if you are working with different pathbases. Or am I wrong?
@tommiie the "origin" should be http://localhost:5000/timemanagement-dev
as in your sample. Otherwise there is an issue with your base path.
This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.
See our Issue Management Policies for more information.
The generated returnUrl
value is
http://localhost:5000/timemanagement-dev
This value is checked to have the same origin as the base path which is
http://localhost:5000/timemanagement-dev/
The check fails because the generated returnUrl
does not have the trailing slash.
dotnet run –pathbase=/myapp
System.InvalidOperationException: Invalid return url. The return url needs to have the same origin as the current page.
The returnUrl in the URL is set correctly.