1
votes

I am adding redirect url in Google console but google is taking redirect URL as http://localhost/authorize/ always. Please see the below code.

credential = GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, Scopes, "user", CancellationToken.None, new FileDataStore(FilePath, true)).Result;

The code is working fine for localhost but not working after hosting in IIS. I have already changed the Redirect url to hosted URL but it is not working.

1

1 Answers

1
votes

The Google .net client library is designed to redirect to http://localhost/authorize/. You need to add that address in the developer console and the client library will handle the rest.

The reason its not working when you release it is because you are using code designed for installed applications not web applications

you should be using GoogleAuthorizationCodeFlow example