Google Login - GetExternalLoginInfoAsync returns null
Hi,
My project use an IdentityServer4 service, an API service and a Blazor App. I try to add Google login, but the SignInManager.GetExternalLoginInfoAsync returns null.
I click the Google button, the Volo.Abp.Account.Web.Pages.Account.LoginModel.OnPostExternalLogin is well called, but the sign-in seems to cause an issue.
Do you have an idea to debug this ?
Here is my code from MyApplicationAccountWebIdentityServerModule:
context.Services
.AddAuthentication(options =>
{
options.DefaultScheme = IdentityConstants.ApplicationScheme;
options.DefaultSignInScheme = IdentityConstants.ExternalScheme;
options.RequireAuthenticatedSignIn = true;
})
.AddGoogle("Google", options =>
{
// Configure here : https://console.developers.google.com/
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
options.ClientId = clientConfig["Google:ClientId"];
options.ClientSecret = clientConfig["Google:ClientSecret"];
})
.AddIdentityCookies();
Hello,
did you find a solution?
Best Regards
What was the solution?
For those who still looking for solution, it's not about startup config. you need to properly set Challenge properties while redirecting.
[HttpGet("/auth/signin/{provider}")]
public async Task<ActionResult<UserInfo>> SignInExternal(string provider, [FromQuery] string redirectUrl)
{
return Challenge(
properties: signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl),
authenticationSchemes: provider
);
}