2amigos/yii2-flysystem-component

GCP Authorization

MaresPradana opened this issue · 1 comments

What steps will reproduce the problem?

I use this configuration to access my Google Cloud Storage project from components.
'fs' => [
'class' => 'dosamigos\flysystem\GoogleCloudFsComponent',
'projectId' => $params['gcsProjectId'],
'bucket' => $params['gcsBucket'],
// 'prefix' => 'your-prefix',
],

What is the expected result?

I can access the GCS

What do you get instead?

{ error: { code: 401, message: Invalid Credentials, errors: [ { message: Invalid Credentials, domain: global, reason: authError, locationType: header, location: Authorization } ] } }

I though this error was occurred on authorization process or Maybe something were wrong when authorization process occurred.

@MaresPradana the easiest way I found was to adding the env path of the service account something like:

putenv("GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service_account.json");

put it into your config file. I put it on config/web.php