Automatic code( authorization code ) redemption using latest version of Katana DLLs in openId authorization code flow
Asked Answered
S

1

6

From the recent release and conversation below, it says that now Katana(4.1.0) supports code-flow with automatic code redemption(that meaning we do not have call tokenendpoint explicitly to redeem the code for idtoken, accesstoken etc)

https://github.com/aspnet/AspNetKatana/pull/297

so, I've upgraded Katana dlls and have p

Notifications = new OpenIdConnectAuthenticationNotifications()
                {
                    RedirectToIdentityProvider = OnRedirectToIdentityProvider,
                    //MessageReceived = OnMessageReceived, -- previous I were calling token endpoint in this notification
                    SecurityTokenReceived = notification => Task.FromResult(0),
                    SecurityTokenValidated = OnSecurityTokenValidated,
                    AuthenticationFailed = OnAuthenticationFailed,
                    AuthorizationCodeReceived = AuthorizationCodeReceived, -- added this notification per latest improvements
                    TokenResponseReceived = TokenResponseReceived
                }

and the implementation here

 private Task AuthorizationCodeReceived(AuthorizationCodeReceivedNotification arg)
    {
        return Task.FromResult(0);
    }

and Im expecting middleware to call the token endpoint to redeem the auth code, which doesn't happen.

Am I missing something here? should I add some code here for the middleware to redeem the code? Please advsie..

Update:

I have set below as per other blogs,

args.App.UseOpenIdConnectAuthentication(
                new OpenIdConnectAuthenticationOptions
                {
                   //other properties removed for brevity
                    SaveTokens = true,
                    RedeemCode = true,
}

still midleware does not redeem codes automatically.

Just a thought, is this supported on in .NET core? Im actually using .NET Framework 4.7.1.

Salable answered 29/1, 2020 at 10:30 Comment(0)
S
6

Actually, the above settings were working and making token api call, but failing due to "clientsecret" was missing in my settings, once corrected everything worked just fine.Thank you.

Salable answered 30/1, 2020 at 14:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.