Switching to HTTP/2 makes calendarList.list() complain about invalid authentication
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript, nodejs
- 領域
- api, authentication, networking
調査の方向性
まず google.options({ http2: true }) と calendarApi.calendarList.list() を使用してスタンドアロンの OAuth2 再現を実行し、次に Node.js クライアントが Authorization の処理に使用する HTTP/2 リクエストパスを調査します。HTTP/2 を使用しないパスと比較します。HTTP/2 が有効な場合でも、認証済みの calendar-list リクエストが 401 を返さなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I have an application that uses an access token to request a list of calendars and then deletes and creates batches of events in a specific calendar.
Everything works, but when I switch on HTTP/2 support:
google.options({
http2: true
})
I get this exception when making the await calendarApi.calendarList.list() call:
Request failed with status code 401.
'{
error: {
code: 401,
message: 'Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.',
errors: [
{
message: 'Invalid Credentials',
domain: 'global',
reason: 'authError',
location: 'Authorization',
locationType: 'header'
}
],
status: 'UNAUTHENTICATED'
}
}
Here's my code (using dotenv and extracted from my project as a standalone test case):
#!/usr/bin/env node
import 'dotenv/config'
import { google } from 'googleapis'
// When this is turned on, requesting the calendar list fails
google.options({ http2: true })
const authClient = new google.auth.OAuth2(
process.env.GOOGLE_CLIENT_ID,
process.env.GOOGLE_CLIENT_SECRET,
'http://localhost:2024',
)
authClient.setCredentials({
access_token: process.env.GOOGLE_ACCESS_TOKEN,
refresh_token: process.env.GOOGLE_REFRESH_TOKEN,
})
const calendarApi = google.calendar({
version: 'v3',
auth: authClient,
})
let response
try {
console.log('Requesting list of calendars...')
response = await calendarApi.calendarList.list()
} catch(e) {
console.error(e.message)
process.exit(1)
}
console.log(response.data.items)
I'm using googleapis 144.0.0 and I tried multiple older versions and the result is the same.
My motivation for switching to HTTP/2 was hitting the "rate limit exceeded" error while performing too many simultaneous operations.
@jrmdayn's drop-in batch request add-on seems to work perfectly for batching the operations and not hitting the rate limit albeit without using HTTP/2, as per https://github.com/googleapis/google-api-nodejs-client/issues/2375#issuecomment-1377330182.
However, I'm still interested in switching to HTTP/2 for its performance benefits and due to it being the new standard.
@JustinBeckwith, I see that you've done a lot of work on the HTTP/2 implementation (#1130). I don't know if you can tell right away what is going on here.
- 主要言語
- TypeScript
- スター
- 12.3k
- フォーク
- 2k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 21
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
googleapis/google-api-nodejs-client のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 32/100
googleapis/google-api-nodejs-client#3932 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Discovery Engine] streamAnswer is typed as one AnswerQueryResponse, but REST returns frame arraysオープン
難易度 3/5 1〜2日 初心者へのやさしさ 64/100
googleapis/google-api-nodejs-client#3930 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
googleapis/google-api-nodejs-client#3927 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
size: l type: feature request
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
googleapis/google-api-nodejs-client#3926 ·
メンテナーはふだん 1 日以内に返信
-
type: feature request
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
googleapis/google-api-nodejs-client#3903 ·
メンテナーはふだん 1 日以内に返信
googleapis/google-api-nodejs-client の issue をすべて見る
似ている issue
-
bug via-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
pingdotgg/t3code#14452 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
solana-foundation/program-examples#747 · コメント 1 件 ·
メンテナーはふだん 9 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
remotion-dev/remotion#11847 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
openwatersio/slackwater#355 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
melgarafael/DeskcommCRM#1998 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信