I am trying to use google authentication in .net core but its giving me error - The oauth state was missing or invalid.
Please suggest what i am doing wrong
I am trying to use google authentication in .net core but its giving me error - The oauth state was missing or invalid.
Please suggest what i am doing wrong
//For google client....
using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
new[] { BooksService.Scope.Books },
"user", CancellationToken.None, new FileDataStore("Books.ListMyLibrary"));
}
// Create the service.
var service = new BooksService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Books API Sample",
});
var bookshelves = await service.Mylibrary.Bookshelves.List().ExecuteAsync();
...
}
Thats the example of how you can create google client and service to make google authentication
Maybe, the problem is that you incorretly set the googleOptions.CallbackPath.
Try this answer. It helped me. https://stackoverflow.com/a/61950614/9547346