Picker API-手动设置access_token [英] Picker API - manually set access_token

查看:59
本文介绍了Picker API-手动设置access_token的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试通过本指南使用 Picker API

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

但是,我的应用程序本身使用Google登录功能登录用户.因此,本指南中的 auth 步骤是多余的,因为从用户登录起,我已经有了一个 access_token (我可以通过交换 auth_code 在服务器上使用节点js google api客户端库).但是,当我尝试使用旧的access_token值调用函数 setOAuthToken(oauthToken)时,它将显示此屏幕而不是Picker,要求我再次登录.

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.

我在这里做错了什么.

推荐答案

原来是 scope 问题-我没有使用授予的新范围(允许使用驱动器)更新我的 refresh_token / access_token setOAuthToken(access_token)正常工作

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

这篇关于Picker API-手动设置access_token的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆