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

  1. The customer has applied for cloud-to-cloud connection and has been approved.
  2. 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 nameConstraintRequest typeField typeValue description
corpRequiredheaderStringCompany ID, provided after cloud docking review
noncerequiredheaderString32-bit random string
timestampRequiredheaderStringTimestamp, in seconds.
signRequiredheaderStringSignature, obtained by signature algorithm
appPackageRequiredqueryStringAPP package path
platformRequiredqueryIntegerPlatform type, 1-iOS, 2-android
openidRequiredqueryStringUser id of the client platform
countryRequiredqueryStringUser registration country ID
Download the country dictionary to check the correct country ID.

Signature Algorithm

  1. Sort the request header parameters nonce, and timestamp in lexicographic order, and connect them to a string with the ampersand, and remove the ampersand at the front end.
  2. Add the apiSecret corresponding to the manufacturer at the end of the string. The apiSecret will be provided after the cloud docking review.
  3. 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&timestamp=1607056133

After splicing, we get:

nonce=5e60dc875e8786526c9e4c7fbfeb67fb&timestamp=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 nameConstraintTypeValue description
codeRequiredIntegerResponse code, see response code description for details
msgRequiredStringResponse message
dataOptionalMapResponse data, including the authentication ticket with the primary key of "ticket" when successful

Response code description

ValueDescription
0Success
499Missing parameter
501The time stamp differs from the current time by more than 5 minutes
502Signature error
500Other general exceptions

Updated at November 17th, 2022