You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PHP调用Google Meet Space API遇PERMISSION_DENIED错误求助

问题

首次尝试集成Google Meet REST API,使用版本为^0.2.3的google/apps-meet包编写了以下PHP代码:

// Create a client.
$spacesServiceClient = new SpacesServiceClient([
    'credentials' => '../shortnet-207309-9a0b32f2b4de.json',
    'scopes' => ['https://www.googleapis.com/auth/meetings.space.created'],
]);

// Prepare the request message.
$request = new CreateSpaceRequest();
$response = $spacesServiceClient->createSpace($request);
return response()->json($response, 200);

调用时返回如下错误:

{ "message": "Permission denied on resource Space (or it might not exist)", "code": 7, "status": "PERMISSION_DENIED", "details": [] }

请问该问题的原因是什么?

可能的原因及解决办法

  • 服务账号未配置域范围委派:Google Meet API的meetings.space.created权限仅对Google Workspace用户开放,服务账号需要在Workspace admin控制台中开启域范围委派,才能模拟域内用户创建空间。非Workspace账号无法通过服务账号调用该API。
  • Google Meet API未启用:检查Google Cloud Console中是否已启用Google Meet API,未启用的话即使权限配置正确也会返回权限拒绝。
  • 作用域未完成授权:在Workspace admin控制台的域范围委派设置中,需确保已添加https://www.googleapis.com/auth/meetings.space.created作用域,且服务账号的客户端ID已被授权使用该作用域。
  • 未指定模拟用户:服务账号自身无创建Meet空间的权限,必须模拟一个Workspace域内的有效用户。你的代码缺少subject参数,需补充指定域内用户邮箱:
    $spacesServiceClient = new SpacesServiceClient([
        'credentials' => '../shortnet-207309-9a0b32f2b4de.json',
        'scopes' => ['https://www.googleapis.com/auth/meetings.space.created'],
        'subject' => 'user@your-domain.com' // 替换为你的Workspace域内用户邮箱
    ]);
    
  • 密钥文件权限异常:确保服务器上的密钥文件有可读权限,避免因无法读取文件导致权限验证失败。

内容的提问来源于stack exchange,提问作者sumanta.k

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.19 22:07:03