我正在尝试使用 xamarin.auth 使用他们的谷歌帐户对用户进行身份验证。一切正常,我也从谷歌获得了访问令牌,但我得到一个弹出窗口,上面写着 ** Authentication error - invalid_grant** 并且它再次重新加载了谷歌登录页面。
void OnAuthenticationCompleted(object sender, AuthenticatorCompletedEventArgs e)
{
if (e.IsAuthenticated)
{
//yay
}
}
e.IsAuthenticated 为真并且接收到访问令牌。
这是我提供给 oauth2authenticator 实例的详细信息
private const string ClientId = "mywebappclientid";//auto generated by firebase
private const string ClientSecret = "mysecret";
private const string Scope = "https://www.googleapis.com/auth/userinfo.email";
private const string AuthorizeUrl = "https://accounts.google.com/o/oauth2/auth";
private const string RedirectUrl ="https://myapp.firebaseapp.com/__/auth/handler";
private const string AccessTokenUrl = "https://accounts.google.com/o/oauth2/token";