当前位置: 首页 > 知识库问答 >
问题:

当dataflow API和服务帐户启用并存在时,如何修复“刷新凭据的问题”错误

傅啸
2023-03-14

“工作流失败。原因:刷新凭据时出现问题。请检查:1.为您的项目启用了Dataflow API。2.为您的项目启用了robot服务帐户:service-[project number]@dataflow-service-producer-prod.iam.gServiceAccount.com应该可以访问您的项目。如果此帐户未出现在项目的”权限“选项卡中,请与Dataflow支持人员联系。您的项目没有cloudservices robot帐户。请确保为您的项目启用了Dataflow API。”

我检查了IAM页面,发现服务帐户在那里,并且具有“Cloud Dataflow service Agent”的角色。我甚至尝试为项目授予服务帐户“所有者”的权限,看看这是否有帮助,但没有帮助。

还有别的想法吗?提前感谢您的帮助!

共有1个答案

梁丘亦
2023-03-14
final static List<String> SCOPES = Arrays.asList(
            "https://www.googleapis.com/auth/cloud-platform",
            "https://www.googleapis.com/auth/devstorage.full_control",
            "https://www.googleapis.com/auth/userinfo.email",
            "https://www.googleapis.com/auth/datastore",
            "https://www.googleapis.com/auth/pubsub");
GoogleCredentials credentials = GoogleCredentials.fromStream(new FileInputStream("/path/to/service/account/keyfile.json"));
options.setServiceAccount("example@project-name.iam.gserviceaccount.com");
options.setGcpCredential(credentials.createScoped(SCOPES));
 类似资料: