【发布时间】:2021-01-27 15:14:24
【问题描述】:
实际上我想验证给定的令牌.. 在另一个流明包中编写的验证代码。当我发送验证令牌的请求时,我遇到了一些问题。我不知道为什么它不起作用。不能在 lumen 内使用其他 api 吗?
如果我在邮递员https://i.stack.imgur.com/kSpJt.png 中使用该检查令牌api。它工作正常。当我在其他 lumen 包中调用该 api 时抛出错误
这是我在邮递员https://i.stack.imgur.com/hfFzk.png使用这个api时得到的
错误日志https://i.stack.imgur.com/ds0oR.png
<?php
namespace App\Helpers;
use App\Helpers\ResponseBuilder;
class check_customer_token_verification
{
public static function check($token, $vendor_id)
{
$client = new \GuzzleHttp\Client();
$result = $client->post('dev.adiswar-crm.local/customer/crm/v-1-0-0/check-token', [
'form_params' => [
'token' => isset($token)?$token:'',
'vendor_id' => $vendor_id,
]
]);
$res_data = json_decode($result->getBody()->getContents()); dd($res_data);
if ($res_data->http_code == 401) {
return ResponseBuilder::responseResult(400, $res_data->message);
}
return $res_data;
}
} ```
dump this api in postman. i got issue which is below
^ {#120
+"http_code": 400
+"message": """
Server error: `POST dev.adiswar-crm.local/customer/crm/v-1-0-0/check-token` resulted in a `500 Internal Server Error` response:
<!DOCTYPE html>
<html>
<head>
<meta name="robots" content="noindex,nofollow" />
<style>
(truncated...)
"""
}```
【问题讨论】:
-
嗯,我看到了 dd($res_data);在您的代码中。
-
我只是想知道我在邮递员中得到了什么回应。这就是我在转储这个时得到的 ^ {#120 +"http_code": 400 +"message": """服务器错误:
POST dev.adiswar-crm.local/customer/crm/v-1-0-0/check-token导致500 Internal Server Error响应: -
你需要定义你的form_params