Created
April 19, 2021 13:59
-
-
Save anderson-marques/45e11db3411700c10950fd32bc02879e to your computer and use it in GitHub Desktop.
Create GCP Access token for Service Accounts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {google} = require('googleapis'); | |
const main = async function() { | |
const auth = new google.auth.GoogleAuth({ | |
keyFile: __dirname + '/service-account-key.json', | |
scopes: [ 'https://www.googleapis.com/auth/cloud-platform'] | |
}); | |
const accessToken = await auth.getAccessToken() | |
console.log(JSON.stringify(auth, null, 4)) | |
console.log(JSON.stringify(accessToken, null, 4)) | |
} | |
main().then().catch(err => console.log(err)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment