Search code examples
oauthyoutube-apigoogle-oauthyoutube-data-api

Request had insufficient authentication scopes youtube api


I have enabled Youtube Api and added Scopes from oAuth Consent screen in Cloud Console it was working before can anyone solve this issue

  {
    I/flutter (21147):   "error": {
    I/flutter (21147):     "code": 403,
    I/flutter (21147):     "message": "Request had insufficient authentication scopes.",
    I/flutter (21147):     "errors": [
    I/flutter (21147):       {
    I/flutter (21147):         "message": "Insufficient Permission",
    I/flutter (21147):         "domain": "global",
    I/flutter (21147):         "reason": "insufficientPermissions"
    I/flutter (21147):       }
    I/flutter (21147):     ],
    I/flutter (21147):     "status": "PERMISSION_DENIED"
    I/flutter (21147):   }
    I/flutter (21147): }

Solution

  • Request had insufficient authentication scopes.

    Means that you have not authorized your application with the scopes required.

    When you authorize a user you tell the user what scope of authorization your application needs.

    lets say you were trying to do a video.insert

    In order to call the video.insert method you need to be authorized with one of the following scopes

    enter image description here

    If you authorized your user with say https://www.googleapis.com/auth/youtube.readonly then you do not have the scope of authorization that you need in order to use that method.

    The solution is to check the documentation to find out which scope of authorization the method you are calling requires. Once you know that you can change the scope in your code and request authorization of the user again.

    it was working before

    I doubt that greatly if it was working before then you have changed or removed the scopes from your code. This is an all or nothing thing its not something that will randomly stop working.