Customer Cloud Authorization
Before you start using the APP SDK, you need to initialize the APP SDK. The ticket is the necessary information to initialize the SDK. Therefore, the main task of the customer cloud authorization is to obtain the current user's ticket information. This ticket has a validity period. If it expires, you need to Reacquire. This document describes how to obtain authentication through API in the cloud.
Requirements
- The customer has applied for cloud-to-cloud connection and has been approved.
- The customer has registered APP information.
Cloud authorization process
After the APP logs in, it needs to request Ticket information from the customer's private cloud. At this time, the customer's private cloud needs to call the cloud authorization interface to Bosma Cloud, request the ticket information, and return it to the APP. The APP will use this ticket to complete the SDK initialization work. . See the cloud authorization flow chart for details.
Cloud authorization interface
API command
POST /sdk/globalcorpuser/applyToken
URL https://www.bosma-iot.com/bosma-smart-global
API request parameters
Parameter name | Constraint | Request type | Field type | Value description |
---|---|---|---|---|
corp | Required | header | String | Company ID, provided after cloud docking review |
nonce | required | header | String | 32-bit random string |
timestamp | Required | header | String | Timestamp, in seconds. |
sign | Required | header | String | Signature, obtained by signature algorithm |
appPackage | Required | query | String | APP package path |
platform | Required | query | Integer | Platform type, 1-iOS, 2-android |
openid | Required | query | String | User id of the client platform |
country | Required | query | String | User registration country ID |
Signature Algorithm
- Sort the request header parameters
nonce
, andtimestamp
in lexicographic order, and connect them to a string with the ampersand, and remove the ampersand at the front end. - Add the
apiSecret
corresponding to the manufacturer at the end of the string. TheapiSecret
will be provided after the cloud docking review. - Concatenate into a string for md5 (32-bit) encryption, get the
sign
parameter value (lower case), and pass it in the request header together.
E.g,
apiSecret=ytuaf6411b24c1c2990746d2a91d8c52
Original request header parameters:
nonce=5e60dc875e8786526c9e4c7fbfeb67fb×tamp=1607056133
After splicing, we get:
nonce=5e60dc875e8786526c9e4c7fbfeb67fb×tamp=1607056133ytuaf6411b24c1c2990746d2a91d8c52
Then md5 encryption gets:
sign=c3fdb6067fbce9f19227803441dd73f1
API request to return data data
The json string contains fields such as code, msg, and data.
Field name | Constraint | Type | Value description |
---|---|---|---|
code | Required | Integer | Response code, see response code description for details |
msg | Required | String | Response message |
data | Optional | Map | Response data, including the authentication ticket with the primary key of "ticket" when successful |
Response code description
Value | Description |
---|---|
0 | Success |
499 | Missing parameter |
501 | The time stamp differs from the current time by more than 5 minutes |
502 | Signature error |
500 | Other general exceptions |