【发布时间】:2019-01-21 08:05:35
【问题描述】:
我在一个 Angular 应用中工作,我想在这个 Angular 应用中添加 Gmail。
我已经按照这个教程https://medium.com/@mcflyDev/angular-2-or-4-import-google-contacts-d0ffb13d8626
一切正常,我收到了access_token 的成功响应,但我没有收到authorization_code。
我怎样才能得到authorization_code?
这是我的配置:
this.auth2 = gapi.auth2.init({
client_id: 'bla-bla-bla-2.apps.googleusercontent.com',
cookiepolicy: 'single_host_origin',
scope: 'https://www.googleapis.com/auth/gmail.readonly',
access_type: 'offline',
response_type: 'code',
auth_uri: 'https://accounts.google.com/o/oauth2/v2/auth',
prompt: 'select_account',
include_granted_scopes: true,
grant_type: 'authorization_code',
});
另外,我也没有得到refresh_token,你可以看到我已经设置了access_type: 'offline'。
我收到了如上图所示的响应。
谢谢。
【问题讨论】:
-
嗨@Arpit Meena 你找到答案了吗? A有同样的问题。
-
@pelcomppl,你在打
POSTAjax 电话吗?
标签: javascript angular google-api gmail-api