我在我的 Angular 8 网站中使用谷歌 API。我必须在不同的按钮上集成 Google Drive 和 YouTube 帐户。
- YouTube 连接按钮
- Google 云端硬盘连接按钮
我将 gapi 初始化为
initGoogleAccounts() {
gapi.load('auth2', () => {
this.googleUser = gapi.auth2.init({
client_id: this.env.google_client_id,
fetch_basic_profile: false,
scope: 'profile'
});
});
}
在 Youtube 按钮上单击
this.googleUser.grantOfflineAccess('https://www.googleapis.com/auth/youtube.force-ssl').then(({code}) => {
this.youtubeCodeConnect(code);
});
但这并不是要求获得 Youtube 权限。有什么我做错了吗?