我想获取从我的应用登录的用户的所有谷歌私人连接。 我已启用Google人员和Google Plus API。我设置了证书API密钥,客户端密码为&。与我试图获取用户的连接的URL是使用谷歌人访问谷歌连接API
https://people.googleapis.com/v1/people/me/connections?fields=connections&key=api_key&access_token=access_token
另外,我使用的库护照谷歌-的OAuth,以获得用户ACCESS_TOKEN。在上面的网址中是否有任何缺少的内容?
我的谷歌授权码是
// send to google to do the authentication
// profile gets us their basic information including their name
// email gets their emails
app.get('/auth/google', passport.authenticate('google', {
scope: ['profile', 'email','https://www.googleapis.com/auth/contacts.readonly', 'https://www.googleapis.com/auth/contacts']
}));
// the callback after google has authenticated the user
app.get('/auth/google/callback',
passport.authenticate('google', {
successRedirect: '/profile',
failureRedirect: '/'
}));
好的。我有API关键的东西。但是,通过access_token,我得到以下错误:**请求缺少必需的身份验证凭据。期望的OAuth 2访问令牌谷歌人api **。我正在使用google-passport-oauth软件包来获取用户令牌和google-api-nodejs-client来访问Google的人员API –
@ParthVyas如果您有访问令牌,请尝试使用它作为请求的标题(也许'授权:“持证人”+ accessToken') – BNK
@BNK你不需要通过加上&access_token =做到这一点,在请求结束时,你正在做同样的事情。 – DaImTo