title: Taro.getAccountInfoSync()

sidebar_label: getAccountInfoSync

Gets the information on the current account.

Reference

Type

  1. () => AccountInfo

Parameters

AccountInfo

The account information.

Property Type Description
miniProgram MiniProgram The information on the Mini Program account
plugin Plugin The information on the plug-in account (required only when this API is called from a plug-in)

MiniProgram

miniProgram is composed as follows

Property Type Description
appId string The appId of the Mini Program

Plugin

plugin is composed as follows

Property Type Description
appId string The AppID of the plug-in
version string The version number of the plug-in

Sample Code

  1. const accountInfo = Taro.getAccountInfoSync();
  2. console.log(accountInfo.miniProgram.appId) // The AppID of the Mini Program
  3. console.log(accountInfo.plugin.appId) // The AppID of the plug-in
  4. console.log(accountInfo.plugin.version) // The plug-in's version number in the format of 'a.b.c'

API Support

API WeChat Mini-Program H5 React Native
Taro.getAccountInfoSync ✔️