Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Auth with Cloud Run Service Account? #3624

Unanswered
noahpodgurski asked this question in Q&A
Discussion options

I can do local auth with the below code using my service account credentials. Set in .env as GOOGLE_APPLICATION_CREDENTIALS=./service-account-key.json

try {
 const auth = new google.auth.GoogleAuth({
 scopes: SCOPES,
 clientOptions: {
 subject: "user@email.com",
 },
 });
 const gmail = google.gmail({ version: "v1", auth });
 return gmail;
 } catch (e) {
 console.error(e);
 return null;
 }

But I'm trying to figure out how to get this working on Cloud Run using the service account on there.. I assumed the auth stuff would be passed in automatically, which doesn't seem right, but also couldn't find any documentation to show otherwise. Has anyone done this before? Any alternatives I can try here?

You must be logged in to vote

Replies: 1 comment

Comment options

There's a number of different ways to authenticate to Cloud Run, please read the documentation. Moving this to Q&A.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #3623 on February 11, 2025 01:35.

AltStyle によって変換されたページ (->オリジナル) /