tencent cloud

Mini Program Login
마지막 업데이트 시간:2025-10-28 11:05:41
Mini Program Login
마지막 업데이트 시간: 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"
}
}


문제 해결에 도움이 되었나요?
더 자세한 내용은 문의하기 또는 티켓 제출 을 통해 문의할 수 있습니다.
아니오

피드백