douzi1350 2018-05-07 15:26
浏览 35

不允许通过转销商API将第一个用户添加到新配置的客户中

We are setting up an easy way to provision new G Suite customers and our project is already capable of creating customers and the respective subscriptions. But users only get some welcome mail from Google and are being told to login. When trying to create the first user through the admin directory api all we get is this:

googleapi: Error 403: Access Not Configured. Admin Directory API has not been used in project xxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/admin.googleapis.com/overview?project=xxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry., accessNotConfigured"

(sensitive information marked with xxx)

The API client is built using the same method as the reseller client and all this is done through our domain-wide delegated service account with the required scopes set in (our) G Suite.

When using the Reseller Console to jump into the new customers admin interface, the API's there are enabled (default).

The docs online don't really tell something about this and just describe how to create the user but no limitations are listed.

We are using the Golang libraries, the user insert looks like this:

...
usr, err := adm.Users.Insert(trial.User).Do()
if err != nil {
    ...
}

...
err = adm.Users.MakeAdmin(usr.PrimaryEmail, &admin.UserMakeAdmin{
    Status: true,
}).Do()
if err != nil {
    ...
}
...

The API client is build like this:

    const envVar = "GOOGLE_APPLICATION_CREDENTIALS"
    if filename := os.Getenv(envVar); filename != "" {
        serviceAccountJSON, err := ioutil.ReadFile(filename)
        if err != nil {
            log.Fatal("creating oauth client failed", zap.Error(err))
        }
        config, err := google.JWTConfigFromJSON(serviceAccountJSON,
            reseller.AppsOrderScope,
            admin.AdminDirectoryUserScope,
        )

        adminClient = config.Client(ctx)
        config.Subject = *impersonationUser
        resellerClient = config.Client(ctx)
    }
    res, _ := reseller.New(resellerClient)
    adm, _ := admin.New(adminClient)
  • 写回答

1条回答 默认 最新

  • dpw43061 2018-05-07 15:37
    关注

    Keeping the question open in case others stumble about this too. The issue was, that in our own project the Admin SDK API got/was disabled.

    Slipped through the setup process so if you encounter this issue, try enabling the Admin SDK API (which is different from the Reseller API).

    评论

报告相同问题?

悬赏问题

  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错