【问题标题】:how to get authenticated user's project role with google cloud APIs如何使用谷歌云 API 获取经过身份验证的用户的项目角色
【发布时间】:2016-08-24 12:12:54
【问题描述】:

我正在尝试通过 PHP Google Cloud API 获取经过身份验证的用户的 Google Cloud 项目角色。

我查看了Google Cloud Accounts API、Google IAM API 和 oAuth API,但没有找到响应所需信息的端点。

我希望通过以下方式收到回复:我已通过 oAuth 向 Google 进行了身份验证。我向端点提交了一个项目 ID(即 my-test-project),如果我有权访问该名称的项目,它会告诉我我在该项目中的角色(所有者、编辑者、查看者或其他 IAM 角色)。

【问题讨论】:

    标签: google-cloud-platform


    【解决方案1】:

    这不是一个精确的解决方案,但它确实提供了用户可以访问的项目:

    $client = new Google_Client();
    ...
    do client oAuth authorization steps
    ...
    // create a BigQuery Services and see what projects it has access to
    $gbq_service = new Google_Service_Bigquery($client);
    $project_list = $gbq_service->projects->listProjects();
    $projects = $project_list->getProjects();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-20
      • 1970-01-01
      • 2019-08-18
      • 2020-10-20
      • 2022-08-14
      • 2021-10-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多