aspnet / Security

[Archived] Middleware for security and authorization of web apps. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
1.27k stars 600 forks source link

Redirect URI is ignored #1926

Closed elukash closed 5 years ago

elukash commented 5 years ago

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?

Tratcher commented 5 years ago

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.

elukash commented 5 years ago

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!