Azure AD B2C AuthenticationResponseChallenge -
i'm working on azure ad b2c last few days, got sample , made running. issue facing aad b2c issue point #3, valuable comment in question may solve problem. example running fine me when implemented in solution, after giving aad b2c credentials i'am ending with:
private async task onredirecttoidentityprovider(redirecttoidentityprovidernotification<openidconnectmessage, openidconnectauthenticationoptions> notification) { policyconfigurationmanager mgr = notification.options.configurationmanager policyconfigurationmanager; if (notification.protocolmessage.requesttype == openidconnectrequesttype.logoutrequest) { openidconnectconfiguration config = await mgr.getconfigurationbypolicyasync(cancellationtoken.none, notification.owincontext.authentication.authenticationresponserevoke.properties.dictionary[startup.policykey]); notification.protocolmessage.issueraddress = config.endsessionendpoint; } else { openidconnectconfiguration config = await mgr.getconfigurationbypolicyasync(cancellationtoken.none, notification.owincontext.authentication.authenticationresponsechallenge.properties.dictionary[startup.policykey]); notification.protocolmessage.issueraddress = config.authorizationendpoint; } }
in 'else' part, authenticationresponsechallenge null, throwing error. can give me detailed reply causing , how resolve it?
i had same problem because actual policykey wasnt initiated correctly, make sure have "policyauthhelpers" (provided microsoft fix current libraries unable handle b2c). step code policyconfigurationmanager.cs , can find why breaks. verify have correct policies configured in web.config, example:
<add key="ida:signinpolicyid" value="b2c_1_signin" />
if doesnt of course hardcode it:
openidconnectconfiguration config = await mgr.getconfigurationbypolicyasync(cancellationtoken.none, notification.owincontext.authentication.authenticationresponsechallenge.properties.dictionary["b2cpolicy"]);
Comments
Post a Comment