我在跟踪 .NET快速入门 为Gmail API添加一个集成到我的.NET Core 2.2应用程序。
由于某些原因, Redirect URI
我的请求中指定的是 不 我指定的那个。
证书.json
{
"web": {
//redacted,
"redirect_uris": [ "https://localhost:44393/ExternalAuth/Gmail" ]
}
}
全权证书仪表板
编码
UserCredential credential;
using (var stream = new FileStream("credentials.json", FileMode.Open, FileAccess.Read))
{
string credPath = "token.json";
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
Scopes,
"user",
CancellationToken.None,
new FileDataStore(credPath, true)
).Result;
Console.WriteLine("Credential file saved to: " + credPath);
}
我似乎找不到它是从哪里获取的;我假设它只是从我的本地机器上拉取的,尽管我想一定有一种方法可以覆盖请求中包含的URI。