wx - 微信开放平台(扫码登录),适用于PC端网站,用户通过微信扫码授权 wechat - 微信服务号(网页授权),仅在微信内置浏览器中有效,适用于公众号菜单、微信内分享链接等场景
JSON| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
appid |
string | 必填 | 应用ID,在"我的应用"中获取,如:f99abb60a4f4439d |
appkey |
string | 必填 | 应用密钥,在"我的应用"中获取,请妥善保管不要泄露 |
type |
string | 必填 | 登录平台类型,可选值:qq、wx(微信开放平台-扫码登录)、wechat(微信服务号-网页授权)、alipay、sina、baidu、github、gitee、google、dingtalk、feishu 等 |
redirect_uri |
string | 必填 | 授权成功后的回调地址,必须与应用配置的授权域名匹配,需进行URL编码。示例:https://example.com/callback.php |
state |
string | 必填 | 自定义状态参数,用于防止CSRF攻击或传递业务数据,回调时会原样返回。建议传入随机字符串并在回调时验证 |
act |
string | 必填 | 接口动作,固定值 login |
<?php
$url = 'https://www.xzzti.cn/API/login/index.php';
$params = ['appid' => 'YOUR_VALUE', 'appkey' => 'YOUR_VALUE', 'type' => 'YOUR_VALUE', 'redirect_uri' => 'YOUR_VALUE', 'state' => 'YOUR_VALUE', 'act' => 'YOUR_VALUE', ];
$url .= '?' . http_build_query($params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
import requests
url = "https://www.xzzti.cn/API/login/index.php"
params = {
'appid': 'YOUR_VALUE',
'appkey': 'YOUR_VALUE',
'type': 'YOUR_VALUE',
'redirect_uri': 'YOUR_VALUE',
'state': 'YOUR_VALUE',
'act': 'YOUR_VALUE',
}
response = requests.get(url, params=params)
print(response.text)
const url = new URL('https://www.xzzti.cn/API/login/index.php');
const params = {
'appid': 'YOUR_VALUE',
'appkey': 'YOUR_VALUE',
'type': 'YOUR_VALUE',
'redirect_uri': 'YOUR_VALUE',
'state': 'YOUR_VALUE',
'act': 'YOUR_VALUE',
};
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]));
fetch(url)
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));