Getting permission denied while getting subscription details from pub/sub events using service account credentials
Maintainer thường phản hồi trong vòng 1 ngày
@sofisl đang làm issue này rồi.
Từ ngày 29/2/2024.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 12.3k
- Fork
- 2k
- Merge trung bình
- 1 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 25
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của googleapis/google-api-nodejs-client
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 32/100
googleapis/google-api-nodejs-client#3932 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Discovery Engine] streamAnswer is typed as one AnswerQueryResponse, but REST returns frame arraysĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
googleapis/google-api-nodejs-client#3930 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
googleapis/google-api-nodejs-client#3927 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
size: l type: feature request
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
googleapis/google-api-nodejs-client#3926 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
type: feature request
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
googleapis/google-api-nodejs-client#3903 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của googleapis/google-api-nodejs-client
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
rohitg00/agentmemory#1428 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
boxlite-ai/boxlite#1729 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Detect Deno tasks from deno.jsonĐang mởdetectors enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
SM260845/readme-gen#1 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
angular/angularfire#3774 ·
Maintainer thường phản hồi trong vòng 2 ngày