Skip to main content
Version: 3.x

Taro.getAccountInfoSync()

Gets the information on the current account.

Reference

Type

() => AccountInfo

Parameters

AccountInfo

The account information.

PropertyTypeDescription
miniProgramMiniProgramThe information on the Mini Program account
pluginPluginThe information on the plug-in account (required only when this API is called from a plug-in)

MiniProgram

miniProgram is composed as follows

PropertyTypeDescription
appIdstringThe appId of the Mini Program

Plugin

plugin is composed as follows

PropertyTypeDescription
appIdstringThe AppID of the plug-in
versionstringThe version number of the plug-in

Sample Code

const accountInfo = Taro.getAccountInfoSync();

console.log(accountInfo.miniProgram.appId) // The AppID of the Mini Program
console.log(accountInfo.plugin.appId) // The AppID of the plug-in
console.log(accountInfo.plugin.version) // The plug-in's version number in the format of 'a.b.c'

API Support

APIWeChat Mini-ProgramH5React Native
Taro.getAccountInfoSync✔️