没有收到电子邮件

时间:2018-09-11 00:04:35

标签: node.js google-apis-explorer

我在我的应用程序上使用google登录,并且使用ionic v3和本机google插件,因此将用户定向到google登录并允许我们访问。一旦用户允许访问,我便将请求发送到后端,在这里我使用从Google发送来的userId来获取用户信息。除了电子邮件地址,我得到了我需要的所有信息。不知道为什么没有显示用户电子邮件。这是我的后端代码:

        const plus = googleAPI.google.plus({
        version: 'v1',
        auth: 'My API Key' 
    });

    plus.people.get({
        userId: googleUserId,
        fields: 'displayName,emails,name'
    })
        .then((user) => {
            console.log('Google plus user: ' + JSON.stringify(user.data));
            console.log('Emails: ' + user.data.emails)
        })
        .catch((err) => {
            console.log('Google plus error: ' + err);
        })

似乎是权限问题,因为在应用程序上,我设置了一个与我的API密钥不同的iOS webClientId。如果是这样,我该如何解决呢?

1 个答案:

答案 0 :(得分:1)

弄清楚,api调用作为get的一部分缺少了accessToken

相关问题