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

Error 403 #867

Closed
gabselbach opened this issue Apr 10, 2019 · 1 comment
Closed

Error 403 #867

gabselbach opened this issue Apr 10, 2019 · 1 comment

Comments

@gabselbach
Copy link

Hello!
I'm trying to run the basic code on the page https://cloud.google.com/natural-language/docs/reference/libraries#client-libraries-install-php, but the following error is displayed :

Uncaught Google\Cloud\Core\Exception\ServiceException: { "error": { "code": 403, "message": "The request is missing a valid API key.", "status": "PERMISSION_DENIED" } } in /home/gabriella/Documents/programacao/pesquisa/vendor/google/cloud/Core/src/RequestWrapper.php:336 Stack trace: #0 /home/gabriella/Documents/programacao/pesquisa/vendor/google/cloud/Core/src/RequestWrapper.php(189): Google\Cloud\Core\RequestWrapper->convertToGoogleException(Object(GuzzleHttp\Exception\ClientException)) #1 /home/gabriella/Documents/programacao/pesquisa/vendor/google/cloud/Core/src/RestTrait.php(95): Google\Cloud\Core\RequestWrapper->send(Object(GuzzleHttp\Psr7\Request), Array) #2 /home/gabriella/Documents/programacao/pesquisa/vendor/google/cloud/Language/src/Connection/Rest.php(69): Google\Cloud\Language\Connection\Rest->send('documents', 'analyzeSentimen...', Array) #3 /home/gabriella/Documents/programacao/pesquisa/vendor/google/cloud/Language/src/LanguageClient.php(220): Google\Cloud\Language\Connection\Re in /home/gabriella/Documents/programacao/pesquisa/vendor/google/cloud/Core/src/RequestWrapper.php on line 336.

@bshaffer
Copy link
Contributor

You must have missed the authentication step in the quickstart. YOu need to download a set of service account credentials and then set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path to those credentials on your filesystem:

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-credentials.json

The instructions to do this are at the top of the quickstart.

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

2 participants