[英]How to get the enterpriseToken when creating an enterprise with the Android Management API?
I'm trying to create a new enterprise using api method.我正在尝试使用 api 方法创建一个新企业。 First I maked signupUrls.create with request parameters projectId and callbackUrl .首先,我使用请求参数projectId和callbackUrl创建了signupUrls.create 。 In field callbackUrl , I put my Google Cloud platform admin url.在字段callbackUrl中,我输入了我的 Google Cloud 平台管理员 url。 And I got a response我得到了回应
{
"name": "signupUrls/C78787fa85be23de9f",
"url": "https://play.google.com/work/adminsignup?token=SAEQ6V4kHngQPk5wCSl37KkZPlfw-wJtlVHndDfsmH1R1twiXM1LC6FpYFSndpEaw2mbsmqd3T5eBaRWtQPrVClngJHZcKaGc0V_4dOhz-F8D0vSjb_1MnxRheUP0Ij8el6zNE5GYYA1LOECCUFLip8kcg6e99_3DfNbmutqHONjhdi8hQBQUa0Q5nWN-nMRF3EUgffvLk1zo4BAA0AUscQ"
}
The next point is method: enterprises.create with projectId , signupUrlName and enterpriseToken parameters.下一点是方法: enterprise.create带有projectId 、 signupUrlName和enterpriseToken参数。
And then I send request I get erorr:然后我发送请求我得到错误:
"message": "The enterprise token is invalid: SAEQ6V4kHngQPk5wCSl37KkZPlfw-wJtlVHndDfsmH1R1twiXM1LC6FpYFSndpEaw2mbsmqd3T5eBaRWtQPrVClngJHZcKaGc0V_4dOhz-F8D0vSjb_1MnxRheUP0Ij8eCUFLip8kcg6e99_3DfNbmutqHONjhdi8hQBQUa0Q5nWN-nMRF3EUgffBWwGHSA8AkFWvLk1zo4BAA0AUscQ",
"status": "INVALID_ARGUMENT"
In the field enterpriseToken I put token values from signupUrls.create url response.在字段enterpriseToken中,我输入了来自signupUrls.create url 响应的令牌值。
To obtain the enterpriseToken
you (or your customer) need to go through the enterprise sign-up flow by visiting the url
returned by signupUrls.create
, which looks like https://play.google.com/work/adminsignup?token=...
(the token in this URL is not the enterpriseToken
).为了获得enterpriseToken
您(或您的客户)需要通过访问要经过企业申请流程中url
由归国signupUrls.create
,它看起来像https://play.google.com/work/adminsignup?token=...
(此 URL 中的令牌不是enterpriseToken
)。
Upon completing the sign-up flow you will be redirected to the callbackUrl
passed in signupUrls.create
, with the enterpriseToken
appended as a parameter.在完成注册流程,你会被重定向到callbackUrl
传入signupUrls.create
,与enterpriseToken
附加作为参数。 So if you set the callbackUrl
to https://example.com/mycallback
you will be redirected to a URL like https://example.com/mycallback?enterpriseToken=...
.因此,如果您将callbackUrl
设置为https://example.com/mycallback
您将被重定向到类似https://example.com/mycallback?enterpriseToken=...
的 URL。
You then need to extract the enterpriseToken
and pass it to enterprises.create
.然后,您需要提取enterpriseToken
并将其传递给enterprises.create
。
So if you create the enterprise yourself you can set any callbackUrl
, even an invalid one, and just copy the enterpriseToken
manually.因此,如果您自己创建企业,您可以设置任何callbackUrl
,甚至是无效的,只需手动复制enterpriseToken
令牌。 However if you want your customer to create the enterprise then the callbackUrl
should point to your server so you can retrieve the enterpriseToken
, you may also want to pass an additional token in the callbackUrl
so you can identify your customer.但是,如果您希望您的客户创建企业,则callbackUrl
应指向您的服务器,以便您可以检索enterpriseToken
,您可能还希望在callbackUrl
传递一个额外的令牌,以便您可以识别您的客户。
More details in the guide for creating an enterprise .更多详细信息,请参阅创建企业指南。
https://play.google.com/work/adminsignup?token=..
how can we call through code using javascript
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.