js-miniapp-sdk

Globals / UserInfoProvider

Interface: UserInfoProvider

Interfaces to retrieve User profile related information.

Hierarchy

Index

Methods

Methods

forceLogout

forceLogout(): Promise<boolean>

Defined in js-miniapp-sdk/src/modules/user-info.ts:73

Send a signal to native application to force a logout

Returns: Promise<boolean>

true if logout is successful


getAccessToken

getAccessToken(audience: string, scopes: string[]): Promise<AccessTokenData | MiniAppError>

Defined in js-miniapp-sdk/src/modules/user-info.ts:41

Fetches the access token from host app.

Parameters:

Name Type Description
audience string one of the audiences provided in MiniApp manifest
scopes string[] scopes array associated to the audience

Returns: Promise<AccessTokenData | MiniAppError>

Access token from native host app.


getContacts

getContacts(): Promise<Contact[]>

Defined in js-miniapp-sdk/src/modules/user-info.ts:33

Fetches the contact list from host app. You should request the CustomPermissionName.CONTACT_LIST permission before using this method.

Returns: Promise<Contact[]>

Contact list in the host app user profile.


getExchangeToken

getExchangeToken(audience: string, scopes: string[]): Promise<AccessTokenData | MiniAppError>

Defined in js-miniapp-sdk/src/modules/user-info.ts:81

Fetches the exchange token from host app.

Parameters:

Name Type Description
audience string one of the audiences provided in MiniApp manifest
scopes string[] scopes array associated to the audience

Returns: Promise<AccessTokenData | MiniAppError>

Exchange token from native host app.


getPhoneNumber

getPhoneNumber(): Promise<string>

Defined in js-miniapp-sdk/src/modules/user-info.ts:56

Fetches the Phone number of the user.

Returns: Promise<string>

Phone number saved in the host app user profile.


getPoints

getPoints(): Promise<Points>

Defined in js-miniapp-sdk/src/modules/user-info.ts:50

Fetches the points from host app.

Returns: Promise<Points>

Points from native host app.


getProfilePhoto

getProfilePhoto(): Promise<string>

Defined in js-miniapp-sdk/src/modules/user-info.ts:26

Fetches the profile photo URI from host app. You should request the CustomPermissionName.PROFILE_PHOTO permission before using this method.

Returns: Promise<string>

Profile photo saved in the host app user profile.


getUserName

getUserName(): Promise<string>

Defined in js-miniapp-sdk/src/modules/user-info.ts:19

Fetches the username from host app. You should request the CustomPermissionName.USER_NAME permission before using this method.

Returns: Promise<string>

Username saved in the host app user profile.


isLoggedIn

isLoggedIn(): Promise<boolean>

Defined in js-miniapp-sdk/src/modules/user-info.ts:61

Fetches the current login status of the user

Returns: Promise<boolean>


triggerLoginUI

triggerLoginUI(): Promise<boolean | MiniAppError>

Defined in js-miniapp-sdk/src/modules/user-info.ts:67

Triggers the login UI in the host app.

Returns: Promise<boolean | MiniAppError>

A promise that resolves to true if the login was successful, false otherwise.