7
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Cloud functions から Google APIsを使う

Posted at

結論

1
コンソールからサービスアカウントに該当するAPIの権限を付ける

2
認証情報なしでデフォルトのまま、googleapisのGoogleAuthを呼び出す。

サンプルコード(カレンダーにアクセスする場合)

const { google } = require('googleapis');
const auth = new google.auth.GoogleAuth({
  scopes: ['https://www.googleapis.com/auth/calendar.readonly'],
});
const calendar = google.calendar({version: 'v3', auth: auth});

終わり。

Cloud Functionsのドキュメントを見てもどこにも書いてなくて困った。

参考資料

7
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?