Choose Organization


Select the OU that a user needs to use after login.

Only after the user logs in and enters an OU, the user’s valid Access Token information can be obtained.

Prerequisites


The user has logged in to Application Portal. You can call the Log In API to log in.

Request Format


POST https://{apigw-address}/app-portal-service/v2.2/session/set

Request Parameters (URI)


Name

Location (Path/Query)

Required/Optional

Data Type

Description

channel

Query

Optional

String

Login source. Supports the following values:

  • EnOS-Mobile: EnOS Mobile.

  • WeCom: WeChat.

  • Web: EnOS Application Portal.

If you need to customize other login sources, contact the system administrator.

Request Parameters (Header)


Name

Required/Optional

Data Type

Description

Authorization

Required

String

The access token generated after the user logs in and selects the OU, represented by Bearer Token, is in the form of Bearer {your token}. You can call the Log In API to obtain the access token.

Request Parameters (Body)


Name

Required/Optional

Data Type

Description

orgId

Required

String

The OU ID. How to get orgId >>

Response Parameters


Name

Data Type

Description

userId

String

The user ID.

userName

String

The user name.

currentOrgId

String

The current OU ID.

currentOrgName

String

The current OU name.

accessToken

String

The access token in the request.

refreshToken

String

The new refresh token that can be used to refresh the access token.

refreshTokenExpire

String

The refresh token expiration time in UTC format. For the time format, see ISO8601 Standard Time Formats Used by UTC.

Error Codes


Error Code

Error Message

Description

31400

orgId is required

OU ID is required

31401

Please login first

Please log in first

31404

Can not find this organization.

OU not found

Samples

Request Sample


url: https://{apigw-address}/app-portal-service/v2.2/session/set?channel=web

method: POST

headers: {"Authorization":"Bearer your_token"}

requestBody:
{"orgId":"yourOrgId"}

Return Sample


{
  "code": 0,
  "message": "OK",
  "data": {
    "userId": "your_user_id",
    "userName": "your_user_name",
    "currentOrgId": "your_org_id",
    "currentOrgName": "your_org_name",
    "accessToken": "your_access_token",
    "refreshToken": "your_refresh_token",
    "refreshTokenExpire": 1570018958000
  }
}