2
身份验证错误

我试图用Google Cloud PubSubGoogle Cloud Dataproc集群,我收到类似下面的认证范围的错误:与云Dataproc和其他谷歌云产品

{ 
    "code" : 403, 
    "errors" : [ { 
    "domain" : "global", 
    "message" : "Request had insufficient authentication scopes.", 
    "reason" : "forbidden" 
    } ], 
    "message" : "Request had insufficient authentication scopes.", 
    "status" : "PERMISSION_DENIED" 
} 

我怎样才能解决这个问题,这样我就可以在Cloud Dataproc上运行的Spark/Hadoop项目中使用PubSub(和其他Google云)产品?

回答

3

默认情况下,Google云Dataproc包含一些authentication scopes,但目前不包含所有Google云端平台产品的范围。您可以通过使用Google Cloud SDK--scopes标志创建示波器来将示波器添加到集群。

例如,使用gcloud beta dataproc clusters create命令添加PubSub范围--scopes https://www.googleapis.com/auth/pubsub时,可以使用以下标志。只要服务处理“全部捕获”范围,您就可以使用--scopes https://www.googleapis.com/auth/cloud-platform一次为许多服务添加范围。

您可以在Google Cloud Platform docs上找到关于验证和授权的更多信息。