Closed janvda closed 4 years ago
This is more of a question for googleapis
.
Heres a link to their code examples: https://github.com/googleapis/google-api-nodejs-client/blob/master/samples/sheets/quickstart.js
An example of how I used it with googlephotos
api: https://github.com/mcpengelly/instagram-saved-to-google-photos-album/blob/master/oauth.ts
Also, I've adapted their code here. but i suggest using their example because this code is incomplete:
app.get('/oauth2callback', (req, res) => {
const code = req.query.code;
client.getToken(code, (err, tokens) => {
...
client.credentials = tokens;
doSomethingWithToken(client);
...
})
})
function doSomethingWithToken(client) {
new Photos(client.credentials.access_token)
...
}
Thanks for the very fast response.
Based on your input, I further looked into it. My code was correct but the access token (string) that I passed to new Photos() was apparently no longer valid.
I have created new credentials and generated new tokes using these credentials and that resolved the issue.
Most likely my implementation is not correct:
An extract of the relevant part of my code:
FYI
node.config.credentials.accessToken
is"ya29.Il-zB8z2qrcP7qP3YVpUlt8NCsvb1ZxtsIHTlPi71HN30wFLJs7c5q..."
.when running the above code I am getting error