New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request had insufficient authentication scopes #2311
Comments
Greetings! You need to pass a list of required scopes for the user to accept in your Please take a look there, and let us know if you have any questions! |
@JustinBeckwith thank you. I've already passed the scope at the time of the user's consent, I need to generate the consent URL again? So I would need to |
More or less, yeah. The first time the user goes through the consent flow, you're going to get both a If you want to use the tokens later, you need to securely store the refresh token, and use it when you re-construct your |
I've tried three configurations, all generate errors for me. I'm still totally lost as to why I would need to generate an auth url for a user that has already consented and for whom I have already saved the Sorry this is making me feel really dumb and frustrated. What am I missing? (1)
(2)
(3)
|
Oh no! There's a misunderstanding here - in your original code, you didn't show how you set the scopes. The refresh_token does encapsulate the scopes you originally requested. In example #1, I think the problem is you want to do something like: const {google} = require('googleapis')
const webmasters = google.webmasters('v3')
const oauth2Client = new google.auth.OAuth2({
clientId: '*****',
clientSecret: '******',
redirectUri: '****',
});
oauth2Client.setCredentials({
refresh_token: 'SAVED REFRESH TOKEN FROM INITIAL CONSENT'
}); That should be enough! The next call you make through that client should "just work". |
Also another data point, I know that the |
@JustinBeckwith I was able to get an hour of help from @soldair and what an adventure. We were able to log and verify that we are getting back a refreshed We were also able to perform http requests to As it relates to this library, it seems like something is happening with Now that I can query the webmasters endpoint via http successfully, maybe I can help scout out this |
Greetings, we're closing this. Looks like the issue got resolved. Please let us know if the issue needs to be reopened. |
I'm trying to access
google.webmasters('v3')
on behalf of a consenting user. I redirect them to the consent url, then storerefresh_token
andaccess_token
from the callback. I'm getting the following error:Request had insufficient authentication scopes
I'm sure I'm doing something dumb or omitting an important process step. Can someone point me in the right direction?
My code looks like:
The text was updated successfully, but these errors were encountered: