"Access Denied" 日历的 Google 验证 API 错误
"Access Denied" error on Google Auth API for Calendar
从昨天开始我一直在尝试验证我对 de Google Calendar V3 API 的请求以便使用它,但我无法通过仅包含文本 "Access Denied".
我的冲突代码是这样的,最后一行中断了:
UserCredential credential;
using (var stream =
new FileStream(HostingEnvironment.MapPath(credentialsPath), FileMode.Open, FileAccess.Read))
{
string credPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
credPath = Path.Combine(credPath, writePath);
var authTask = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
Scopes,
"user",
CancellationToken.None,
new FileDataStore(credPath, true)
);
credential = authTask.Result;
}
我已经尝试重新创建密钥,再次生成 client_secret.json 文件,创建另一个凭据...我也知道 JSON 和文件夹这两个路径都是正确的,因为我必须在出现此错误之前解决该问题。
关于可能是什么问题的任何提示?
谢谢!
"Access Denied" 错误通常是由于 Invalid Credentials 而遇到的。
以下是您可以尝试的建议操作:
- Get a new access token using the long-lived refresh token.
- If this fails, direct the user through the OAuth flow, as described in Authorizing requests with OAuth 2.0.
- If you are seeing this for a service account, check that you have successfully completed all the steps in the service account page.
希望对您有所帮助!
从昨天开始我一直在尝试验证我对 de Google Calendar V3 API 的请求以便使用它,但我无法通过仅包含文本 "Access Denied".
我的冲突代码是这样的,最后一行中断了:
UserCredential credential;
using (var stream =
new FileStream(HostingEnvironment.MapPath(credentialsPath), FileMode.Open, FileAccess.Read))
{
string credPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
credPath = Path.Combine(credPath, writePath);
var authTask = GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
Scopes,
"user",
CancellationToken.None,
new FileDataStore(credPath, true)
);
credential = authTask.Result;
}
我已经尝试重新创建密钥,再次生成 client_secret.json 文件,创建另一个凭据...我也知道 JSON 和文件夹这两个路径都是正确的,因为我必须在出现此错误之前解决该问题。
关于可能是什么问题的任何提示? 谢谢!
"Access Denied" 错误通常是由于 Invalid Credentials 而遇到的。
以下是您可以尝试的建议操作:
- Get a new access token using the long-lived refresh token.
- If this fails, direct the user through the OAuth flow, as described in Authorizing requests with OAuth 2.0.
- If you are seeing this for a service account, check that you have successfully completed all the steps in the service account page.
希望对您有所帮助!