Getting permission denied while getting subscription details from pub/sub events using service account credentials
メンテナーはふだん 1 日以内に返信
@sofisl がすでに取り組んでいます。
2024年2月29日 から。
評価
この issue はまだ評価されていません。
説明
Hi there,
I used google cloud pub/sub api to receive messages using the endpoint url, here I was able to receive events in the backend, but when I tried getting subscription details using the service account credentails, I got permission denied. It worked successfully when tried using OAuth redirecting to the browser, but I need to handle it in the backend to store/modify subscription details in the database, so OAuth2 doesn't seem to be viable option.
I have tried the following code snippet.
require('dotenv').config();
(async () => {
const subscription = {
message: {
data: '<sample-subscription>',
messageId: '10553462436995277',
message_id: '10553462436995277',
publishTime: '2024-02-27T12:30:55.34Z',
publish_time: '2024-02-27T12:30:55.34Z'
},
subscription: '<subscription-id>',
};
const decodedData = Buffer.from(subscription.message.data, 'base64').toString('utf-8');
console.log(decodedData);
const {
subscriptionNotification: { purchaseToken, subscriptionId },
packageName,
} = JSON.parse(decodedData);
console.log(JSON.parse(decodedData));
const { google } = require('googleapis');
const androidpublisher = google.androidpublisher({
version: 'v3',
auth: new google.auth.JWT({
keyFile: './creds.json', // service account creds, i saw in the google console that it has owner permissions
scopes: ['https://www.googleapis.com/auth/androidpublisher'],
}),
});
const response = await androidpublisher.purchases.subscriptions.get({
packageName: packageName,
subscriptionId: subscriptionId,
token: purchaseToken,
});
console.log(response);
})();
The error I am getting is:
{
status: 401,
code: 401,
errors: [
{
message: 'The current user has insufficient permissions to perform the requested operation.',
domain: 'androidpublisher',
reason: 'permissionDenied'
}
],
}
these are permissions I saw in the google cloud console.
Don't know what to do in this case!
Thanks in advance!
@proppy @dazuma @jskeet @hansoksendahl @andrelaszlo
- 主要言語
- TypeScript
- スター
- 12.3k
- フォーク
- 2k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 21
環境構築
はじめの一歩
- 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
-
priority: P2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
prime-radiant-inc/evener#3291 ·
メンテナーはふだん 1 日以内に返信
-
accessibility bug revealjs
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
quarto-dev/quarto-cli#14961 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
supabase/agent-skills#614 ·
-
Content
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
RunestoneInteractive/rs#1559 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信