[googleapi] The request uses the \u003ccode\u003emine\u003c/code\u003e parameter but is not properly authorized

whired123

Member
Joined
Nov 15, 2021
Messages
82
Reaction score
5
Credits
613
Code:
$ curl "https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&mine=true&key=$KEY"
{
  "error": {
    "code": 401,
    "message": "The request uses the \u003ccode\u003emine\u003c/code\u003e parameter but is not properly authorized.",
    "errors": [
      {
        "message": "The request uses the \u003ccode\u003emine\u003c/code\u003e parameter but is not properly authorized.",
        "domain": "youtube.parameter",
        "reason": "authorizationRequired",
        "location": "mine",
        "locationType": "parameter"
      }
    ]
  }
}

The request uses the \u003ccode\u003emine\u003c/code\u003e parameter but is not properly authorized.

Why?

Looking a little around it seems to me to guess that it is necessary to use the OAuth 2.0 authentication, but since I am not very good with these things, could you provide me with a feeling and concrete example?
 


But the example is in js, which I'm not a great expert in.

I did some tests anyway

Code:
<!-- Taking inspiration from https://stackoverflow.com/q/44708358/11889508 -->

<!DOCTYPE html>
<html>

<head>
    <script>
        function abc() {
            if(GoogleAuth.currentUser.get().hasGrantedScopes(SCOPE)){
                $.ajax({
                    url:'https://www.googleapis.com/youtube/v3/playlists',
                    data:{
                        'key':'AIzaSyD0OY6xhl9gP9CmPXvU-rN-purRDaTrip8',
                        'mine':'true',
                        'maxResults':'5',
                        'part':'snippet,contentDetails'
                    },
                    sucess:function(data){
                        console.log(data);
                    },
                    error:function(data){
                        console.log(data.responseText);
                    }
                });
            }
        }
    </script>
</head>

<body onload="abc()">
</body>

</html>

In console

Code:
Uncaught ReferenceError: GoogleAuth is not defined
    at abc (index.html:9:13)
    at onload (index.html:30:22)
abc @ index.html:9
onload @ index.html:30

mmmhhh... someone who can help me?

Anyway I would prefer to use the curl command.
 


Members online


Latest posts

Top