aspnet / Security

[Archived] Middleware for security and authorization of web apps. Project moved to https://github.com/aspnet/AspNetCore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redirect URI is ignored

elukash opened this issue · comments

Hi.

I'am trying to run google auth challenge with callback url

// Request a redirect to the external login provider.
var redirectUrl = Url.Action(nameof(ExternalLoginCallback), "Account", new { ReturnUrl = returnUrl });
var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl);
return Challenge(properties, provider);

But error occurs

The redirect URI in the request, https://localhost:44386/signin-google, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs

Seems like default redirect URI has been used, is not it?

The redirect uri specified in your sample code is where you want the app to return to after the authentication is complete. /signin-google handles an intermediate response to complete the authentication and then redirect to the redirect uri you specified. /signin-google is what you should register with google.

The redirect uri specified in your sample code is where you want the app to return to after the authentication is complete. /signin-google handles an intermediate response to complete the authentication and then redirect to the redirect uri you specified. /signin-google is what you should register with google.

Now it works fine. Thanks!