• Server support is delivered by the Chevereto Community. As the server is a basic requirement, any server issue won't be considered for Chevereto Tech Support and it will be handled in this section.

Can't add Google Cloud Storage to external storage

Alan306051

Network license
License owner
I can't add Google Cloud Storage to external storage.
I follow all the step on Chevereto documentation.
When I fill in the Private key box
Code:
"/path/of/file/XXX.json"
Chevereto didn't show anything but in console it show like that
capture.PNG

I try to fill my private_key shown in my json file, no matter what like
Code:
-----BEGIN PRIVATE KEY-----\n[PRIVATE-KEY]\n-----END PRIVATE KEY-----\n
or
Code:
[PRIVATE-KEY]
, Chevereto show
Code:
Can't insert storage. Error: Google cloud storage client connect error: set the JSON service account credentials using Google_Client::setAuthConfig or set the path to your JSON file with the "GOOGLE_APPLICATION_CREDENTIALS" environment variable and call Google_Client::useApplicationDefaultCredentials to refresh a token with assertion. - check your input parameters
 

Rodolfo

Chevereto creator
Chevereto Staff
Hi,

When I fill in the Private key box
Code:
"/path/of/file/XXX.json"
Chevereto didn't show anything but in console it show like that
Of course, the system expects the actual JSON document key. Not the path to the json file. It won't work either with the direct key, the system expects a JSON document containing the key.

Here's the implementation:
app/lib/classes/class.storage.php:
                    $client = new \Google_Client();
                    $client->setApplicationName('Chevereto Google Cloud Storage');
                    $client->addScope('https://www.googleapis.com/auth/devstorage.full_control');
                    $credentials = json_decode(trim($storage['secret']), true);
                    $client->setAuthConfig($credentials);
                    $client->fetchAccessTokenWithAssertion();
                    if (!$client->getAccessToken()) {
                        throw new Exception('No access token');
                    }
Provide the complete JSON document and it should work for you.
 

Alan306051

Network license
License owner
What do you mean?
Provide the complete JSON document
Is it mean I provide like this in the Private key box?
Code:
{
"type": "service_account",
"project_id": "[PROJECT-ID]",
"private_key_id": "[KEY-ID]",
"private_key": "-----BEGIN PRIVATE KEY-----\n[PRIVATE-KEY]\n-----END PRIVATE KEY-----\n",
"client_email": "[SERVICE-ACCOUNT-EMAIL]",
"client_id": "[CLIENT-ID]",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/[SERVICE-ACCOUNT-EMAIL]"
}
 

Alan306051

Network license
License owner
I find that when I were using php7.0, I got the error.
But when I change to use php7.3, I suddenly can add the storage.
šŸ˜«šŸ˜ŖšŸ˜«
 

kispervn

Core license
License owner
Error: Google cloud storage client connect error: set the JSON service account credentials using Google_Client::setAuthConfig or set the path to your JSON file with the "GOOGLE_APPLICATION_CREDENTIALS" environment variable and call Google_Client::useApplicationDefaultCredentials to refresh a token with assertion. - check your input parameters
 

Rodolfo

Chevereto creator
Chevereto Staff
Error: Google cloud storage client connect error: set the JSON service account credentials using Google_Client::setAuthConfig or set the path to your JSON file with the "GOOGLE_APPLICATION_CREDENTIALS" environment variable and call Google_Client::useApplicationDefaultCredentials to refresh a token with assertion. - check your input parameters
You have to provide the key as this:
1586899148586.png

https://chevereto.com/docs/storages#google-cloud-storage

You have to open the key file, which is a JSON document and paste it "as is".
 
Top