getInfo

Updated at:

Retrieves user information.

Method definition

mpserverless.user.getInfo(): Promise<Result>

Return parameters

Field

Type

Description

success

Boolean

Indicates whether the operation was successful.

result.user

Object

User information.

The user parameter contains the following fields:

Field name

Type

Description

spaceId

String

The service space ID.

userId

String

The user ID generated by the Serverless platform.

oAuthUserId

String

The user's Alipay, DingTalk, or WeChat identity ID.

createdAt

Number

The timestamp in milliseconds of the user's first log on.

lastSeenAt

Number

The timestamp in milliseconds of the user's last log on.

Example

After completing the initialization, call the getInfo method.

const { result } = await mpserverless.user.getInfo();

console.log(result)

Example output:

{
    user: {
        createdAt: 1658388913000
        lastSeenAt: 1658899909000
        oAuthUserId: "2088112127******"
        spaceId: "mp-f215973f-****-****-92a8-b09690c7f4ee"
        userId: "62d901b15321303781******"
    }
}