私は自分のアプリケーションからサインインしたユーザーのすべてのGoogleプライベート接続を取得したいと思います。 Google People APIとGoogle Plus APIを有効にしました。資格APIキー、クライアントID &のクライアント秘密を設定しました。私は、ユーザーの接続を取得しようとしているとのurlは、私は、図書館パスポート - グーグルのOAuth-を使用しているユーザーがaccess_tokenは得るために、またGoogleの人々のAPIを使用してGoogleの接続にアクセス
https://people.googleapis.com/v1/people/me/connections?fields=connections&key=api_key&access_token=access_token
です。私が上記のURLに欠けているものはありますか?
私のGoogleの認証コードは、あなたが取得しているが、URLを見て、あなたは私はあなたにいくつかのことを伝えることができます使用しているエラー言及していない
// 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アクセストークンgoogle people api **。私はあなたのアクセスのトークンを持っている場合は、あなたのリクエストのヘッダーとしてそれを使用してください(ユーザーのトークン&グーグル –
@ ParthVyasの人々のAPIにアクセスするgoogle-api-nodejs-clientを取得するために、パッケージgoogle-passport-oauthを使用していますおそらく 'Authorization:" Bearer "+ accessToken') – BNK
@BNKあなたは同じことをやっているリクエストの最後にタック&access_token =することでこれを行う必要はありません。 – DaImTo