mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-05 05:42:45 +08:00
modified 优化Token获取方式
This commit is contained in:
parent
aa14f1e2c1
commit
b47aa8c985
@ -42,7 +42,7 @@ php think apiadmin:adminRouter
|
||||
> 第五步:获取管理后台账号密码
|
||||
|
||||
```
|
||||
cat application/install/lock.ini
|
||||
cat install/lock.ini
|
||||
```
|
||||
|
||||
## 灵 感
|
||||
|
@ -30,6 +30,7 @@ class BuildToken extends Base {
|
||||
|
||||
$signature = $param['signature'];
|
||||
unset($param['signature']);
|
||||
unset($param['Access-Token']);
|
||||
$sign = $this->getAuthToken($appInfo['app_secret'], $param);
|
||||
$this->debug($sign);
|
||||
if ($sign !== $signature) {
|
||||
|
@ -50,7 +50,16 @@ class ApiAuth {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$accessToken = $request->header('Access-Token', '');
|
||||
if (!$accessToken) {
|
||||
if ($apiInfo['method'] == 2) {
|
||||
$accessToken = $request->get('Access-Token', '');
|
||||
}
|
||||
if ($apiInfo['method'] == 1) {
|
||||
$accessToken = $request->post('Access-Token', '');
|
||||
}
|
||||
}
|
||||
if (!$accessToken) {
|
||||
return json([
|
||||
'code' => ReturnCode::AUTH_ERROR,
|
||||
|
Loading…
x
Reference in New Issue
Block a user