Share via

Authorization code is not generating after deploying on AppService

Aniruddhya Khatua (MINDTREE LIMITED) 0 Reputation points Microsoft External Staff
2023-11-28T18:58:13.48+00:00

I have a Asp.net MVC web application that uses OpenIdConnect Auth code flow for user authentication. The code is working fine when we are debugging locally. We noticed that Authorization code is not generating after deploying in AppService.

Below is my code snippet -

app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

app.UseCookieAuthentication(new CookieAuthenticationOptions
{
    // ...
    CookieManager = new SystemWebCookieManager(),
});


app.UseOpenIdConnectAuthentication(
    new OpenIdConnectAuthenticationOptions
    {
        ClientId = ConfigHelper.ClientId,
        Authority = $"
        PostLogoutRedirectUri = ConfigHelper.PostLogoutRedirectUri,
        RedirectUri = ConfigHelper.PostLogoutRedirectUri,
        Scope = ConfigHelper.AppScope,
        TokenValidationParameters = new TokenValidationParameters
        {
            ValidateIssuer = false,
        },
        CookieManager = new SystemWebCookieManager(),
        Notifications = new OpenIdConnectAuthenticationNotifications
        {
            AuthorizationCodeReceived = OnAuthorizationCodeReceivedAsync,
            AuthenticationFailed = OnAuthenticationFailedAsync
        }
    });

Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.