O GoogleWebAuthorizationBroker não está funcionando no host do IIS
Estou usando o código a seguir para autenticar no Google usando a biblioteca do cliente .Net do Google.
public static void auth()
{
string clientId = "xxxxxx.apps.googleusercontent.com";
string clientSecret = "xxxxx";
string[] scopes = new string[] { "https://www.googleapis.com/auth/contacts.readonly" }; // view your basic profile info.
try
{
// Use the current Google .net client library to get the Oauth2 stuff.
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets { ClientId = clientId, ClientSecret = clientSecret }
, scopes
, "test"
, CancellationToken.None
, new FileDataStore("test")).Result;
// Translate the Oauth permissions to something the old client libray can read
OAuth2Parameters parameters = new OAuth2Parameters();
parameters.AccessToken = credential.Token.AccessToken;
parameters.RefreshToken = credential.Token.RefreshToken;
RunContactsSample(parameters);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Estou usando meu próprio ID de cliente e chave secreta do cliente. Esse código está funcionando perfeitamente quando estou executando no visual studio, mas não está funcionando depois de hospedado no IIS.
E eu mencionei o URI redirecionado no console da API do Googlehttp: // localhost / autorize /
Meu URL do host do IIS éhttp: //localhost/googleintegration.aspx
Estou enfrentando esse problema no último mês, alguém pode dar uma solução para isso ..