Jul*_*n J 6 javascript google-api google-oauth
我目前正在根据指南gapi.oauth2使用该软件包来更换软件包,一切正常。TokenClient
global.google.accounts.oauth2
.initTokenClient({
client_id: CONFIG.google.clientId,
scope: 'https://www.googleapis.com/auth/drive.readonly',
ux_mode: 'popup',
callback(tokenResponse) {
if (tokenResponse && !tokenResponse.error) {
onSuccess(tokenResponse.access_token);
return;
}
onError(tokenResponse.error || 'google authentication failed');
},
})
.requestAccessToken({});Run Code Online (Sandbox Code Playgroud)
唯一的问题是我们没有使用 ,gapi.client并且更愿意避免加载该包,因为我们仅使用令牌来通过使用 来显示选择器google.picker.PickerBuilder。现在,在初始化之后,GSI 包尝试使用gapi.client.setToken(),但由于未加载包,因此显然会失败。
[GSI_LOGGER-TOKEN_CLIENT]:设置令牌失败。Gapi.client.setToken 未定义。
所以现在我在参考文献中找不到任何关于如何防止该调用发生的内容,也找不到如何至少通过不使用 anoop作为占位符来抑制警告。
有谁知道是否有任何官方方法来处理这个问题?