1

I am facing an issue with External login using google. We have login using google feature on the website

I have used this blog to implement google login. I am able to redirect the user to gmail on clicking the google login button on the sitecore website and receive the response(user profile) back in Sitecore. But after receiving the response, I am not able to create user in sitecore as the create user method(Sitecore.Security.Accounts.User.User.Create(fullName, password);) does not register the user without password. As this is external login so I don't have password. I just get name and email of the user from gmail

I don't want to use Sitecore federated authentication as I have to enable federated authentication in the Sitecore configuration.

1 Answer 1

1

In your situation, you might find a virtual user is more appropriate. You can create as below:

string domain = "external";

Sitecore.Security.Accounts.User user =
    AuthenticationManager.BuildVirtualUser(string.Format(@"{0}\{1}", domain, loginInfo.Email), true);

AuthenticationManager.LoginVirtualUser(user);

this.Redirect(Context.Site.GetRootItem().Url());

Some useful references here:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.