We can’t do things like thumbnail swaps and title swap using the Youtube API (thumbnails.set)!
After the initial authentication everything works fine for the first few days, but then our clients eventually get a 403 error. This is how we are creating the link to generate access and refresh tokens through our app.
async function authenticateURL(scopes, referringUrl) {
const authUrl = oAuth2Client.generateAuthUrl({
access_type: 'offline',
scope: scopes.join(' '),
prompt: 'consent'
});
return authUrl;
}
const scopes = [
'https://www.googleapis.com/auth/youtube.force-ssl',
'https://www.googleapis.com/auth/youtube', // already has youtube force-sll
'https://www.googleapis.com/auth/yt-analytics.readonly',
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email',
];
This is the error:
data: {
error: {
code: 403,
message: "The thumbnail can't be set for the specified video. The request might not be properly authorized.",
errors: [
{
message: "The thumbnail can't be set for the specified video. The request might not be properly authorized.",
domain: 'youtube.thumbnail',
reason: 'forbidden',
location: 'videoId',
locationType: 'parameter'
}
]
}
}
We are confused and we think its because of rate limits. So we are assuming each user should get 10000 credits, and they can swap titles or thumbnails 200 times a day.
It works again if the user does the authentication process again, but this is not ideal!
We are able to access other parts of the youtube api on behalf of the client, like get channel or search information.
We are able to refresh the accessToken using the refresh token.
john is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.