YouTube数据API错误403权限不足 [英] YouTube Data API Error 403 Insufficient Permission

查看:71
本文介绍了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()

这篇关于YouTube数据API错误403权限不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆