tencent cloud

Tencent Cloud Super App as a Service

Release Notes and Announcements
Announcement: Tencent Cloud Mini Program Platform Renamed to Tencent Cloud Super App as a Service on January 2, 2025
Console Updates
Android SDK Updates
iOS SDK Updates
Flutter SDK Updates
IDE Updates
Base Library Updates
Product Introduction
Overview
Strengths
Use Cases
Purchase Guide
Billing Overview
Pay-As-You-Go Billing
Renewal Guide
Service Suspension Instructions
Getting Started
Plan Management
Overview
Console Account Management
Storage Configuration
Acceleration Configuration
Branding Configurations
Platform Features
Console Login
Users and Permission System
Mini Program Management
Mini Game Management
Superapp Management
Commercialization
Platform Management
User Management
Team Management
Operations Management
Security Center
Code Integration Guide
Getting Demo and SDK
Android
iOS
Flutter
Superapp Server
GUID Generation Rules
Mini Program Development Guide
Mini Program Introduction and Development Environment
Mini Program Code Composition
Guide
Framework
Components
API
Server Backend
JS SDK
Base Library
IDE Operation Instructions
Mini Game Development Guide
Guide
API
Server Backend
Practice Tutorial
Mini Program Login Practical Tutorial
Mini Program Subscription Message Practical Tutorial
Payment Practical Tutorial
Ad Integration Practical Tutorial
Mini Game Subscription Message Practical Tutorial
API Documentation
History
Introduction
API Category
Making API Requests
Operation Management APIs
User Management APIs
Team Management APIs
Sensitive API-Related APIs
Role Management APIs
Platform Management APIs
Other Console APIs
Mini Program or Mini Game APIs
Management-Sensitive APIs
Global Domain Management APIs
Superapp APIs
Data Types
Agreements
Service Level Agreement
Data Processing and Security Agreement
SDK Privacy Policy Module
SDK Data Processing and Security Agreement Module

Mini Program Login

PDF
Focus Mode
Font Size
Last updated: 2025-10-28 11:05:41
Note:
Only supported on SaaS.

jscode2session

Request method: GET
Request URL: /openserver/sns/jscode2session

Request parameters

Property
Type
‍Required
Description
appid
string
True
Mini program appId.
secret
string
True
Mini program appSecret.
js_code
string
True
Code obtained during login.
grant_type
string
True
Authorization type: use authorization_code

Response parameters

Property
Type
‍Required
Description
session_key
string
True
Session key.
errmsg
string
True
Error message.
openid
string
True
Unique user identifier.
unionid
string
True
If a mini program team has multiple mini programs or mini games, UnionlD can be used to distinguish the uniqueness of users. As long as they are mini programs or mini games under the same mini program team, the user's UnionlD is unique. In other words, the same user, within the same app, will have the same UnionlD when logging in to different mini programs or mini games under the same mini program team.
errcode
int32
True
Error code.
{
"errcode": 40029,
"errmsg": "invalid js_code",
"openid": "",
"requestId": "84574d84227943298cb25e26a6d2b816",
"session_key": "",
"unionid": ""
}

getAccessToken

Request method: GET
Request URL: /openserver/cgi-bin/token

Request parameters

Property
Type
‍Required
Note
appid
string
True
Mini program appId.
secret
string
True
Mini program appSecret.
grant_type
string
True
Enter client_credential.

Response parameters

Property
Type
‍Required
Note
access_token
string
True
Access token.
expires_in
number
True
Token validity period in seconds. Value range: usually 7200 seconds.
{
"access_token": "ATZrSqJXfZkAZVRIJxTNZJwyZLZJjPJhKpibbjuGgHpQzZwbCDPvGGfWKSbJlSMX",
"errcode": 0,
"errmsg": "ok",
"expires_in": 7200,
"requestId": "5486f23fd3b64c2c84c9798ead510aa7"
}

checkSessionKey

Request method: GET
Request URL: /openserver/wxa/checksession

Request parameters

Property
Type
‍Required
Note
access_token
string
True
Access token.
openid
string
True
Unique user identifier.
signature
string
True
User login state signature, obtained by signing an empty string with session_key. That is, signature = hmac_sha256(session_key, "").
sig_method
string
True
Hash method for user login state signature, currently only supports hmac_sha256.

Response parameters

Property
Type
‍Required
Note
errcode
number
True
Error code
errmsg
string
True
Error message.

getuserphonenumber

Request method: POST。
Request URL: /openserver/wxa/business/getuserphonenumber。

Request parameters

Property
Type
‍Required
Note
access_token
string
True
Access token.
openid
string
True
Unique user identifier.
code
string
True
temporary code
{
"access_token":"ATIfWyEpUVHcyGHHqCEspuuALGNyoBFpLwTNdRMLsdJAdJPEJHvrEYSlhZQtJojF",
"openid":"b642cf744a16d2010b60242ab6b7ded99a895a60e857a9dc17eadcb73f790cfd",
"code":"807636166d9c4155aacc7fbeae7b9bfa"
}

Response parameters

Property
Type
Note
errcode
number
Error code.
errmsg
string
Error message.
phone_info
object
Phone info
phone_info.phoneNumber
string
Phone number. This parameter is obtained by calling the JS SDK wx.getPhoneNumber API
{
"errcode": 0,
"errmsg": "ok",
"phone_info": {
"phoneNumber": "xxxxxx"
}
}

getemailaddress

Request method: POST。
Request URL: /openserver/wxa/business/getemailaddress。

Request parameters

Property
Type
‍Required
Note
access_token
string
True
Access token.
openid
string
True
Unique user identifier.
code
string
True
Temporary code. This parameter is obtained by calling the JS SDK wx.getEmailAddress API
{
"access_token":"ATIfWyEpUVHcyGHHqCEspuuALGNyoBFpLwTNdRMLsdJAdJPEJHvrEYSlhZQtJojF",
"openid":"b642cf744a16d2010b60242ab6b7ded99a895a60e857a9dc17eadcb73f790cfd",
"code":"807636166d9c4155aacc7fbeae7b9bfa"
}

Response parameters

Property
Type
Note
errcode
number
Error code.
errmsg
string
Error message.
email_address
object
email_address
email_address.emailAddress
string
emailAddress
{
"errcode": 0,
"errmsg": "ok",
"email_address": {
"emailAddress": "xxxxxx"
}
}



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback