Azure / Azure/static-web-apps

Aad auth callback url does gives Exception: Correlation failed.

Open
#630 0 comments 0 reactions 0 assignees View on GitHub
AuthN/Z
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

Developing dotnet core service with endpoint like : http://localhost:86/controller/api(param)

Overall flow aim is
1. User enters full url in browser http://localhost:86/controller/api(param)
2. Users navigate to AAD login page
3. After successful log in redirect back to “controller/api(param)”

AAD app asks to specify redirect url in AAD app portal and these urls can’t be dynamic like “controller/api(param) since param can take any value.

What I have tried so far is :

In middle ware added
httpContext.ChallengeAsync(
new AuthenticationProperties
{
RedirectUri = "/controller/callback",
});

And in OIDC added
services.AddAuthentication(AzureADDefaults.AuthenticationScheme)
.AddAzureAD(options =>
{
options.Instance = authConfig.AzureAdInstance;
options.Domain = "microsoft.onmicrosoft.com";
options.TenantId = authConfig.AzureAdTenantId;
options.ClientId = authConfig.AzureAdClientId;
options.CallbackPath = "controller/checksignin";
});

AAD portal has redirect url set to "controller/checksignin";
With this combination, after login page call fails in landing on action " controller/checksignin ";

shows error below

![image](https://user-images.githubusercontent.com/11233980/141597592-f20c0ed4-1912-4745-98cb-a8c82552869a.png)

![image](https://user-images.githubusercontent.com/11233980/141597679-bbd5c346-c8c6-4b58-9297-07bba10e3722.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.