Request had insufficient authentication scopes youtube api - oauth

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): }

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
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.

Related

ABP swagger can't authorize

I'm using abp.io IdentityServer4 separated (tiered) solution, I see that Swagger UI has the following endpoints, but when I call them, I'm getting error 401 (not authorized), also Swagger UI doesn't have Authorize button by default.
How should I solve the issue, to be able to call those endpoints?
Here's the error response I get:
{
"error": {
"code": null,
"message": "Authorization failed! Given policy has not granted.",
"details": "AbpAuthorizationException: Authorization failed! Given policy has not granted.\r\nSTACK TRACE: at
...
}

Comments: update gives 403 forbidden insufficient permissions

I tried this API here and in my code and got this error everywhere. However, other methods, such as commentThreads.insert() or comments.delete(), work fine, so I don't think this issue is scopes or OAuth 2.0 authorization related.
Here is the response I get:
{
"error": {
"code": 403,
"message": "The comment could not be updated due to insufficient permissions. The request might not be properly authorized.",
"errors": [
{
"message": "The comment could not be updated due to insufficient permissions. The request might not be properly authorized.",
"domain": "youtube.comment",
"reason": "forbidden",
"location": "body",
"locationType": "other"
}
]
}
}
UPD:
Apparently, you can only update the comment under your own video. But you can delete your comment from any video. I don’t know why they did it that way and didn't even write about it in the docs. I also wrote to them on https://issuetracker.google.com/

Youtube Comment API: Comment Insert 403 forbidden insufficient permissions

This is what im using to add comments to youtube :
gapi.client.youtube.commentThreads.insert({
part: "snippet", commentData
}).then(function (response) {
console.log("response", response);
})
This is what im getting while hit that :
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission: Request had insufficient authentication scopes."
}
],
"code": 403,
"message": "Insufficient Permission: Request had insufficient authentication scopes."
}
}
Insufficient Permission: Request had insufficient authentication scopes.
Means exactly that the currently authenticated user has not granted you the permissions to do that.
If you check the documentation comments.insert you will see that in order to use this method you must have authncated your user with the https://www.googleapis.com/auth/youtube.force-ssl scope

YouTube API V3 Comment Threads doesn't work with access Token

I am trying to call the following url with my access token which is for getting comments from a video but it doesn't seem to work and gives me a Insufficient Permissions Error.
Here's the URL I try to call-
https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&maxResults=1&videoId=tdUX3ypDVwI&access_token={myAccessToken}
but it sends me the following error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission"
}
],
"code": 403,
"message": "Insufficient Permission"
}
}
Apparently, It doesn't make sense to me? Please help.
You need the following scope :
https://www.googleapis.com/auth/youtube.force-ssl

Google blogger api and expired secret key.

I have already managed to add some posts to my blog using google api and oauth and ran into some problems. I have tried for days - or weeks - to find the best question to ask and I believe I have isolated the problem. Apparently the secret key only works only for one hour. but after an hour at this line:
$service->blogs->getByUrl("theurlofmyblog.blogspot.com");
I get this error:
Google_Service_Exception in REST.php line 118:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
Some of the experts on forums have suggested that one must go to this address https://developers.google.com/oauthplayground/ and get a referesh token. But nobody has mentioned that how should we use that token. Do I put it inside the json file? There must be something like this - don't laugh please, this is supposed to be a suedo code -:
if(the key is expired)
use my referesh key and get me another key
Any experience?
As described in Google’s OAuth 2.0 documentation, you should receive a refresh token during the authentication flow. You should store that token someplace, then use it to get a new access token when necessary.
The exact procedure to exchange a refresh token for a new access token will depend on what OAuth client library you are using. In Signet (Google’s OAuth library for Ruby), for example, it’s done as part of fetch_access_token.

Resources