I have 2 apps - let's call them App1
and App2
.
Both are Blazor server projects. From App1
, we pass through user identity data to authenticate with in App2
.
The endpoint in App2
is a component named ExternalAuth
accepting 2 parameters:
@page "/externalauth/{EncryptedData}/{EncryptApiKey}"
@using FinnivoClients_BlazorServer.Services
@inject NavigationManager NavigationManager
@inject ExternalAuthService ExternalAuthService
@code {
[Parameter] public string EncryptedData { get; set; }
[Parameter] public string EncryptApiKey { get; set; }
protected override async Task OnInitializedAsync()
{
if (string.IsNullOrEmpty(EncryptedData) || string.IsNullOrEmpty(EncryptApiKey))
{
NavigationManager.NavigateTo("/");
return;
}
bool isAuthenticated = await ExternalAuthService.AuthenticateExternalUser(EncryptedData, EncryptApiKey);
if (isAuthenticated)
NavigationManager.NavigateTo("/", forceLoad: true);
else
NavigationManager.NavigateTo("/error");
}
}
In App1
, it is just a simple button click to redirect to this address:
private async Task RedirectToClientApp()
{
// Only encode the values once
string targetUrl = $"/{encodedData}/{encodedKey}";
// Open the URL in a new tab
NavigationManager.NavigateTo(targetUrl);
}
The issue is when we use the live azure link, I get the following error -> The resource you are looking for has been removed, had its name changed, or is temporarily unavailable
When using localhost to test on it works perfectly, example:
private async Task RedirectToClientApp()
{
// Only encode the values once
string targetUrl = $"https://localhost:8080/externalauth/{encodedData}/{encodedKey}";
// Open the URL in a new tab
NavigationManager.NavigateTo(targetUrl);
}
It even works when I edit take the encoded values and pass it to the localhost link.
What can the cause be, and what can I do to sort this issue?
I tried changing the encoding, and tested various scenarios from taking the last part of the url, and passing it into the localhost link.
Example url - /n3P8LR1PQPkROlih5O1uVRMWaoN4xqo%252BFW41mUUpagS73wExcOhhkgv5uH0FLA9ec