文档
测试

登录接口

POST
https://localhost:8080/onlogin

请求头

参数名
类型
描述
必填
Content-Type
application/x-www-form-urlencoded
设置请求体数据类型
必填

请求参数

参数名
类型
描述
必填
appid
String
小程序AppID
必填
secret
String
小程序Appsecret
必填
js_code
String
用户登录时获取的临时登录凭证
必填
grant_type
String
固定值为 authorization_code,表示使用授权码方式登录
必填

响应参数

参数名
类型
描述
必填
openid
string
用户的唯一标识符
必填
session_key
string
此次会话密钥
必填
union_id
string
用户在小程序内的唯一标识符
必填

说明 / 示例

wx.login({ success (res) { if (res.code) { //发起网络请求 wx.request({ url: 'https://example.com/onLogin', data: { code: res.code } }) } else { console.log('登录失败!' + res.errMsg) } } })