tencent cloud

All product documents
Tencent Cloud Super App as a Service
Mini Program Login
Last updated: 2025-03-27 11:11:09
Mini Program Login
Last updated: 2025-03-27 11:11:09
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.
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 mumber
{
"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
{
"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"
}
}


Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon