'ASP.NET MVC Google oauth authorization error. 'Error 400: redirect_uri_mismatch'

When I try to add Google login in my ASP.NET MVC app, follow this resource:

https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/google-logins?view=aspnetcore-6.0 https://developers.google.com/identity/sign-in/web/sign-in

I get an error:

Error 400: redirect_uri_mismatch

You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy. \n\nIf you're the app developer, register the redirect URI in the Google Cloud Console.

Learn more
Request Details

The content in this section has been provided by the app developer. This content has not been reviewed or verified by Google.
If you're the app developer, make sure that these request details comply with Google policies.
redirect_uri=https://localhost:7082/

How should I fix this?

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source