- What you're trying to do
- I completed an Oauth2 flow to get the user's consent and stored the refresh token
- In the flow, I ask for sensitive scope (let's say youtube.channel-owner)
- I made another API call under this refresh token permission and scope but got an error: 'Access forbidden. The request may not be properly authorized.'
- What code you've already tried
// Init auth client snippet
const oauth2Client = new google.auth.OAuth2(
CLIENT_ID,
CLIENT_SECRET
);
const _credentials: Credentials = {};
_credentials.refresh_token = refreshToken;
if (!!accessToken) {
_credentials.access_token = accessToken;
}
_credentials.scope = 'https://www.googleapis.com/auth/youtube.channel-memberships.creator';
oauth2Client.setCredentials(_credentials);
...
// API call
const resp = await google.youtube('v3').members.list({
part: ['snippet'],
filterByMemberChannelId: userChannelId,
auth: oauth2Client,
});
- Any error messages you're getting
'Access forbidden. The request may not be properly authorized.'
Could someone please help me with this? Thanks in advance.
- What you're trying to do
- What code you've already tried
- Any error messages you're getting
'Access forbidden. The request may not be properly authorized.'
Could someone please help me with this? Thanks in advance.