YouTube数据API错误403权限不足
我正在使用Swift开发IOS应用,该应用需要访问用户的YouTube订阅.添加所有范围后,我需要在Google Cloud Platform上并在Firebase中实现GoogleSignIn.我登录(GIDSignInButton),然后在发出此请求后得到如下所示的错误:
I'm working on an IOS app using Swift that requires accessing to the user's YouTube subscriptions. After adding all scopes I need on Google Cloud Platform and implementing GoogleSignIn in Firebase. I sign in (GIDSignInButton), then I get the error shown down below after making this request:
https://www.googleapis.com/youtube/v3/subscriptions?part = snippet%2CcontentDetails& mine = true& key = \(apiKey)& access_token = \(Access_Token)
Access_Token是我打电话后得到的:
The Access_Token is the one I got after I call:
func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error?){
user.authentication.accessToken
....}
我得到的错误:
["error": {
code = 403;
errors = (
{
domain = global;
message = "Insufficient Permission";
reason = insufficientPermissions;
}
);
message = "Request had insufficient authentication scopes.";
status = "PERMISSION_DENIED";
}]
在应用代理"中,我对此进行了设置:
In App Delegate I set this:
GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID
我遇到了同样的问题,如果我没有记错的话,这是在我的OAuth同意验证状态未经验证的情况下发生的.我要做的是,除了在Google信息中心中提供范围外,我还以编程方式在登录之前将其添加了.
I had the same problem and, if I remember correctly, it occurred when my OAuth consent verification status was unverified. What I did to make it work was, in addition to supplying scopes in the Google dashboard, I added them programmatically before signing in.
GIDSignIn.sharedInstance().scopes.append("https://www.googleapis.com/auth/youtube.upload")
GIDSignIn.sharedInstance().signIn()