我正在使用Bosch IoT Suite的权限服务。
我在生成代理凭据时遇到问题。我需要指定什么步骤和参数来生成代理凭证?我正在尝试创建一个代理凭据,该凭据能够自动激活新创建的用户帐户。
答案 0 :(得分:4)
以下是为Bosch IoT Suite权限创建代理凭证的步骤:
目的
使用权限的AuthorizedClient
先决条件
从Bosch IoT权限中查看该指南:https://permissions.s-apps.de1.bosch-iot-cloud.com/docs/developer-guide/index.html#Getting-started---Bosch-IoT-Suite_216542264
指南
POST https://permissions-api.s-apps.de1.bosch-iot-cloud.com/2/rest/authentication
Headers:
x-im-client-access-token: <....>
Authorization Basic <username:password> (Base64 encoded username:password)
POST https://permissions-api.s-apps.de1.bosch-iot-cloud.com/2/rest/authorization/HAX?scope=pn
Headers:
x-im-client-access-token: <....>
Authorization: Bearer <authentication token>
POST https://permissions-api.s-apps.de1.bosch-iot-cloud.com/2/rest/users/current/agent-credentials
Headers:
x-im-client-access-token: <....>
Authorization: Bearer <authorization token>
Body:
{
"scopes": [ "pn" ]
}
在Java实现中的用法
Permissions.createClientBuilder()
.clientId(clientId)
.clientSecret(clientSecret)
.serviceUrl(serviceUrl)
.build();
permissionsClient.authenticate()
.agentCredentialsId(agentCredentialsId)
.password(agentPassword)
.andCreateAuthorizedClient()
.executeAndGet()
.getAuthorizedClient();