We are using the technique described here to create a refresh token to use Google drive and store it in a config setting for production
Once we get the refresh token, we use the 3 items client_id
, secret_token
and refresh_token
inside this library to write files into Google Drive and it has been working great with ONE server
Once we started having multiple servers, we are getting authentication errors and we suspect that it is because of this refresh_token
being shared on all (currently 4 servers).
Questions for folks who may have encountered this before
- Do we need to create 4 sets of
client_id
, secret_token
and refresh_token
?
- Do we just need one refresh token per server?
Exact error below
[2021-01-24 00:01:40] production.ERROR: {
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
{"exception":"[object] (GoogleServiceException(code: 401): {
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
at /var/www/projectname/php/vendor/google/apiclient/src/Http/REST.php:128)
[stacktrace]
#0 /var/www/projectname/php/vendor/google/apiclient/src/Http/REST.php(103): GoogleHttpREST::decodeHttpResponse(Object(GuzzleHttpPsr7Response), Object(GuzzleHttpPsr7Request), 'Google_Service_...')
#1 [internal function]: GoogleHttpREST::doExecute(Object(GuzzleHttpClient), Object(GuzzleHttpPsr7Request), 'Google_Service_...')
question from:
https://stackoverflow.com/questions/65924170/google-drive-api-refresh-token-multiple-servers 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…