Created
January 15, 2023 12:27
-
-
Save poojarsn/cf6f79f33e0e2e4643bf3bb5ce42ba58 to your computer and use it in GitHub Desktop.
Sitecore Azure AD B2C User.Identity.IsAuthenticated is false Set AuthenticationManager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Reference | |
https://blog.baslijten.com/federated-authentication-in-sitecore-error-unsuccessful-login-with-external-provider/ | |
*/ | |
public void SignIn(string returnUrl) | |
{ | |
// The param returnUrl is configured in Azure B2C Identity Provider. | |
// The redirect URL is to redirect to externallogincallback method of Sitecore Owin and then load returnUrl Sign-in | |
var properties = new AuthenticationProperties() { RedirectUri = "https://abc/identity/externallogincallback?ReturnUrl=/sign-in" }; | |
//retain returnUrl to later redirect user to the page they first started | |
if(!string.IsNullOrWhiteSpace(returnUrl)) | |
properties.Dictionary["returnUrl"] = returnUrl; | |
System.Web.HttpContext.Current.GetOwinContext().Authentication.Challenge(properties, | |
new string[] { "AzureB2C", "SignUpSignInPolicyKey" }); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment