Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Request had invalid authentication credentials. #2

Closed
janvda opened this issue Dec 2, 2019 · 4 comments
Closed

Getting Request had invalid authentication credentials. #2

janvda opened this issue Dec 2, 2019 · 4 comments

Comments

@janvda
Copy link
Owner

janvda commented Dec 2, 2019

More precisely the following error is raised in node-red editor:

StatusCodeError: 401 - {"error":{"code":401,"message":"Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","status":"UNAUTHENTICATED"}}

@janvda
Copy link
Owner Author

janvda commented Dec 2, 2019

@janvda
Copy link
Owner Author

janvda commented Dec 2, 2019

Further investigation revealed that the access token expires after 1 hour.
google.auth.OAuth2 is automatically retrieving new access token using the refresh token but the new access token is not used by Photos().

For this googlephotos library will be extended with a new method to update the access token => see roopakv/google-photos#19

@janvda
Copy link
Owner Author

janvda commented Dec 3, 2019

when the acces_token expires, it is also not automatically refreshed or more precisely the method oauth2Client.on('tokens', ... is never triggered.

So, it is not clear how I can "force" an automatic refresh of the access token.
See also googleapis/google-api-nodejs-client#1177

See also googleapis/google-api-nodejs-client#1256

@janvda
Copy link
Owner Author

janvda commented Dec 3, 2019

This has been fixed by commit 43d3387 and earlier commits.

So it will during startup use the refresh token to request a new access token.

@janvda janvda closed this as completed Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant