Trying to use Google Cloud vision to analyze files already stored in Google Cloud Storage. My code:
$vision = new VisionClient([
'projectId' => $projectId,
'keyFilePath' => <json key file>,
'scopes' => 'https://www.googleapis.com/auth/cloud-platform'
]);
I grab a full http path to my file, which is valid, but when I:
$image = $vision->image( fopen(<file>, 'r'), [ 'LABEL_DETECTION' ]);
I get the error:
Fatal error: Uncaught exception
'Google\Cloud\Core\Exception\ServiceException' with message '{
"error": {
"code": 403,
"message": "Request had insufficient authentication scopes.",
"status": "PERMISSION_DENIED"
}
}'
I can open the file fine ($x = fopen(filename) works), so I'm not sure what's happening here. Is there a way I can check what my service client has in the way of permissions?