# Mini Program Login
The developer's server on a third-party platform can obtain the session_key and openid by implementing the login feature for a Mini Program using the login credential (code) and the third-party platform's component_access_token. The session_key is a key used to encrypt and sign user data. To ensure the security of your apps, you shall not transmit the session_key over the Internet.
# Request Address
GET https://api.weixin.qq.com/sns/component/jscode2session?appid=APPID&js_code=JSCODE&grant_type=authorization_code&component_appid=COMPONENT_APPID&component_access_token=COMPONENT_ACCESS_TOKEN
# Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| appid | string | Yes | The AppID of the Mini Program |
| js_code | string | Yes | The code obtained via wx.login |
| grant_type | string | Yes | Enter authorization_code |
| component_appid | string | Yes | Third-party platform's AppID |
| component_access_token | string | Yes | Token |
# Response Parameters
| Parameter | Type | Description |
|---|---|---|
| openid | string | The openid that uniquely identifies a user |
| session_key | string | The session key |
Example of returned result for a successful request:
{
"openid": "OPENID",
"session_key": "SESSIONKEY"
}
Example of returned result for a failed request:
{
"errcode": "40029",
"errmsg": "invalid code"
}