Users

inquiryUserInfo

Retrieve authorized user details with an access token.

Overview

POST /v1/users/inquiryUserInfo returns user attributes based on scopes granted through my.getAuthCode. Pass the accessToken issued by applyToken; the response includes profile details such as login identifiers, name, avatar, and contact info when authorized.

  1. Mini Program calls my.getAuthCode with the desired scopes to request authorization.
  2. Wallet app renders the authorization page to the user.
  3. User reviews and approves the authorization in the super app.
  4. Wallet app service submits the authorization result to the wallet backend.
  5. Wallet backend validates the authorization and generates an authCode.
  6. Wallet app service returns the authCode to the Mini Program.
  7. Mini Program forwards the authCode to the merchant backend.
  8. Merchant backend invokes /v1/authorizations/applyToken with the authCode to obtain tokens.
  9. Wallet backend returns accessToken (and refresh token) to the merchant backend.
  10. Merchant backend calls /v1/users/inquiryUserInfo with the accessToken.
  11. Wallet backend responds with user information corresponding to the granted scopes.

Endpoint

MethodPath
POST/v1/users/inquiryUserInfo

API Structure

A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see: OpenAPIs Overview.

Request

FieldTypeRequiredDescriptionExample
accessTokenstringYesAccess token for querying user info (max 128 characters; disallow @, #, ?). Obtain via applyToken."281010033AB2F588D14B43238637264FCA5AAF35xxxx"
extendInfostringNoOptional metadata (max 4096 characters; no @, #, ?).{ "memo": "memo" }
{
  "accessToken": "281010033AB2F588D14B43238637264FCA5AAF35xxxx"
}

Response

FieldTypeRequiredDescription
resultobjectYesOutcome metadata containing status and error codes.
userInfoobjectNoUser attributes allowed by the authorized scopes. Returned when result.resultStatus is S.
{
  "result": {
    "resultCode": "SUCCESS",
    "resultStatus": "S",
    "resultMessage": "success"
  },
  "userInfo": {
    "userId": "1000001119398804",
    "loginIdInfos": [
      {
        "loginIdType": "MOBILE_PHONE",
        "maskLoginId": "964*******01"
      }
    ],
    "userName": {
      "fullName": "Jack Second Third Sparrow",
      "firstName": "Jack",
      "secondName": "Second",
      "thirdName": "Third",
      "lastName": "Sparrow"
    },
    "avatar": "https://example.com/avatar.png",
    "gender": "M",
    "birthDate": "2020-07-25",
    "nationality": "IRQ",
    "contactInfos": [
      {
        "contactType": "MOBILE_PHONE",
        "contactNo": "964*******01"
      }
    ],
    "extendInfo": {}
  }
}

Result Processing Logic

StatusDescription
SInquiry succeeded. Use userInfo data per the authorized scopes.
UResult unknown (resultCode: UNKNOWN_EXCEPTION). Retry or review Common error codes.
FInquiry failed. Inspect resultCode and see Error codes.

Error Codes

Error CodeResult StatusMessageNext Step
INVALID_ACCESS_TOKENFAccess token invalid.Obtain a new authorization code via my.getAuthCode, then exchange using applyToken.
EXPIRED_ACCESS_TOKENFAccess token expired.Refresh using applyToken with the refreshToken.