Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In below code I am trying to authenticate in C#.

UserCredential credential;
       ClientSecrets cs = new ClientSecrets() { ClientId = "client-id.apps.googleusercontent.com", ClientSecret = "somesecret" };

       credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
           cs,
           Scopes,
           "user",
           CancellationToken.None,
           null).Result;



Above code is pretty standard below is the setting I have done when I run the application (IIS Express) it runs on “http://localhost:54247/ which i have entered in Authorised redirect URL and Authorised javascript origins.



When I run the above code AuthorizeAsync() gives me below error. The port in the error changes everytime, seems like it is at the run time.
redirect_uri_mismatch
the redirect uri in the request http://127.0.0.1:58821/authorize/, does not match....

If there any setting I’ve missed or am I doing it wrong pls advice.

What I have tried:

I have tried different combinations using client_secret.json and different port publishing on local iis but nothing worked
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900