Skip to content

Commit 38bf4d0

Browse files
authored
Skip scope check when requesting a new token from ADC. (#50)
We are already requesting the token with the cloud-platform scope so it doesn't seem necessary to check it again. Also, not all auth clients implement OAuth2Client. e.g., IdentityPoolClient.
1 parent c01dc23 commit 38bf4d0

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/auth.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,7 @@ async function getApplicationDefaultCredentials() {
5454
projectId: 'unused-project'
5555
});
5656
const client = await auth.getClient();
57-
const creds = (await client.getAccessToken()).token;
58-
const tokenScopes = (await client.getTokenInfo(creds)).scopes;
59-
if (!tokenScopes.includes(
60-
'https://www.googleapis.com/auth/cloud-platform')) {
61-
throw new Error(
62-
'Token has insufficient authentication scopes.\n' +
63-
'Please configure access scope following instructions on ' +
64-
'https://cloud.google.com/artifact-registry/docs/access-control#compute');
65-
}
66-
return creds;
57+
return (await client.getAccessToken()).token;
6758
}
6859

6960
/**

0 commit comments

Comments
 (0)