有什么方法可以从Google Calander API获取用户信息(电子邮件,名称,个人资料图像)吗?

时间:2019-12-30 18:48:57

标签: node.js google-api google-calendar-api

我想保存允许我的应用在其中编辑日历的用户的用户信息。下面的代码是我从某些网站选择的代码,似乎无法正常工作。

async function getProfile(code) {
  const OAuth = await createConnection()
  const {tokens} = await OAuth.getToken(code)
  OAuth.setCredentials(tokens)
  const profile = google.oauth2({
    auth: OAuth,
    version: 'v2'
  })
  await profile.userinfo.get((res) => {
    console.log('This is the data ' + res.data)
  })
}

0 个答案:

没有答案