我有以下客户端密钥。
{
"web": {
"client_id": "testid",
"project_id": "testproj",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://www.googleapis.com/oauth2/v3/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "test-sec",
"redirect_uris": [
"https://localhost:8080/oauth2callback"
]
}
}
我遇到了一个问题:
"错误:redirect_uri_mismatch 请求中的重定向URI,http://127.0.0.1:8414/authorize/,与OAuth客户端授权的URI不匹配。
要更新已授权的重定向URI,请访问:“”。请问您有什么解决方法?
我正在使用C#。我已经创建了以下凭据 -
GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, scopes,
"user",
CancellationToken.None,
new FileDataStore(Directory.GetCurrentDirectory() + "\\AccessToken\\" ,
true)).Result;
但是第一次使用时,它会弹出登录窗口,一旦我登录成功,它就会在文件夹中创建Google.Apis.Auth.OAuth2.Responses.TokenResponse-user
文件。有没有办法绕过第一次登录?
谢谢。
https://localhost:8080/oauth2callback
更改为http://127.0.0.1:8414/authorize/
。 - Tobias Tengler