doutan8601 2017-01-10 05:34
浏览 45
已采纳

Google管理员SDK自定义方案问题

I need help on custom scheme on Google. I successfully get the user list from delegation. Below is my code.

$client = new \Google_Client();
$client->setApplicationName('xx');
$scopes = array('www.googleapis.com/auth/admin.directory.user','www.googleapis.com/auth/admin.directory.userschema');
$client->setAuthConfig('C:\Users\xx\xx\public\client_secret.json');
$client->setScopes($scopes);
$user_to_impersonate = 'xx.sg';
$client->setSubject($user_to_impersonate);

$dir = new \Google_Service_Directory($client);
$r = $dir->users->get('xxx@xx.com');
dd($r);

Userscheme have been added to Google also.

But the custom scheme I got is empty.

https://i.stack.imgur.com/0JcfZ.png

If I use projection = full in developers.google.com/admin it works.

https://i.stack.imgur.com/9s3MQ.png

Can someone help?

  • 写回答

1条回答 默认 最新

  • doumao1917 2017-01-10 06:16
    关注

    The documentation says:

    You can fetch custom fields in a user profile by setting the projection parameter in a users.get or users.list request to custom or full.

    so I would replace your line:

    $r = $dir->users->get('xxx@xx.sg');
    

    with:

    $optParams = array('projection' => 'full');
    $r = $dir->users->get('xxx@xx.sg', $optParams);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度