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上找到關於驗證和授權的更多信息。