【发布时间】:2020-08-23 03:16:58
【问题描述】:
我正在关注 Gmail API 的 .NET Quickstart,以便将集成添加到我的 .NET Core 2.2 应用程序中。
出于某种原因,我的请求中指定的Redirect URI 不是我指定的。
credentials.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?
【问题讨论】: