Vision is Not Logging in on host system, but is everywhere else.
brandonapt opened this issue · 5 comments
One of my friends wanted to port his testing code on repl.it to WSL2 Ubuntu 20.04 LTS on my PC. It was authenticating fine using this start script:
export GOOGLE_APPLICATION_CREDENTIALS='/home/brandon/config.json' && node index.js picture.jpg
But, even after making sure the location is correct, and making sure the code is the exact same, it is still not logging in. Below is a snippet of the error:
/home/brandon/node_modules/@grpc/grpc-js/build/src/call.js:31
return Object.assign(new Error(message), status);
^
Error: 16 UNAUTHENTICATED: 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.
at Object.callErrorFromStatus (/home/brandon/node_modules/@grpc/grpc-js/build/src/call.js:31:26)
at Object.onReceiveStatus (/home/brandon/node_modules/@grpc/grpc-js/build/src/client.js:180:52)
at Object.onReceiveStatus (/home/brandon/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:336:141)
at Object.onReceiveStatus (/home/brandon/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:299:181)
at /home/brandon/node_modules/@grpc/grpc-js/build/src/call-stream.js:160:78```
config.json format:
```{
"type": "service_account",
"project_id": "xxx",
"private_key_id": "xxx",
"private_key": "-----BEGIN PRIVATE KEY-----xxxxxxxxnolookingatmykey> "client_email": "xxx",
"client_id": "xxx",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/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/xxx"
}```
Please help me! Thanks!
My markdown skills kinda suck. Sorry!
Hi, would you also be able to provide some of the relevant JavaScript code, too?
All it is is the 'object detection' sample from the samples.
https://github.com/googleapis/nodejs-vision/blob/HEAD/samples/detect.js
We can check to see if authentication is working in that environment outside of the API. After installing the gcloud SDK, can you try this on the command-line, and see if you get any errors?
gcloud auth activate-service-account --key-file=<FULL_PATH_TO_CONFIG_JSON>
Since we haven't heard back, we'll go ahead and close this. If you have any more information, please feel free to reopen the issue.