I would like to use @google-cloud client lib to insert data to BigQuery.
Since I have multiple clients and each has different IAM role I can\'t use a service account like th
The JSON object you shared is not an OAuth token, it looks like a OAuth2Client object from @google-auth-library.
An actual OAuth token is simply a string, like "ya29.ABC123ABC123_cG123ABCDETCETCETC".
That "token" is actually an OAuth2Client then you can fetch the token with the getAccessToken
method. If it is just a plain JSON object, then you can get the credentials.access_token
field, is the actual access token.
Note that access tokens expire. getAccessToken
will get a new one if necessary, but just getting the access_token from the object will not, and can result in 403s after it expires.