Search code examples
google-apigoogle-drive-apigoogle-picker

Picker API - manually set access_token


I am trying to use the Picker API using this guide, and following the guide works fine.

However, my app uses Google sign-in itself to log in the user. Therefore, the auth step in this guide is redundant, as I already have an access_token from when the user logged in (I obtain this by exchanging the auth_code on the server using the node js google api client lib). However, when I try to call the function setOAuthToken(oauthToken), using this old value of access_token, it shows me this screen rather than the Picker, asking me to log in again.

image

What am I doing wrong here.


Solution

  • Turns out it was a scope issue - i wasn't updating my refresh_token/access_token with the new scopes granted (permissions to use drive) setOAuthToken(access_token) works just fine