Laravel Passport не возвращает токен на предъявителя
Я использовал Laravel
Passport
создать brearer token
в моем web service
, Это мой код:
$bearerToken = $this->tokenGenerate($request->username, $request->pass);
return $bearerToken;
А также tokenGenerate
функция как ниже:
public function tokenGenerate($username, $password)
{
$client = new GuzzleClient();
$response = $client->request('POST', env('APP_URL') . '/oauth/token', [
RequestOptions::JSON => [
"username" => $username,
"password" => $password,
"grant_type" => "password",
"client_id" => 7,
"client_secret" => "avTabhOqPCsq81q1aYqnLa9HmAWLE3Gz0Ey78kds",
"theNewProvider" => "subscribers",
'scope' => '*',
]
]);
return $response;
}
Он не работает должным образом и просто возвращает переданное имя пользователя, когда я проверяю web service
в Postman
,
Когда я меняю return $response
в dd($response)
, это результат:
Response {#808
-reasonPhrase: "OK"
-statusCode: 200
-headers: array:6 [
"Date" => array:1 [
0 => "Sun, 13 Jan 2019 10:09:48 GMT"
]
"Server" => array:1 [
0 => "Apache/2.2.15 (CentOS)"
]
"X-Powered-By" => array:1 [
0 => "PHP/7.2.13"
]
"Content-Length" => array:1 [
0 => "11"
]
"Connection" => array:1 [
0 => "close"
]
"Content-Type" => array:1 [
0 => "text/html; charset=UTF-8"
]
]
-headerNames: array:6 [
"date" => "Date"
"server" => "Server"
"x-powered-by" => "X-Powered-By"
"content-length" => "Content-Length"
"connection" => "Connection"
"content-type" => "Content-Type"
]
-protocol: "1.1"
-stream: Stream {#823
-stream: stream resource @636
wrapper_type: "PHP"
stream_type: "TEMP"
mode: "w+b"
unread_bytes: 0
seekable: true
uri: "php://temp"
options: []
}
-size: null
-seekable: true
-readable: true
-writable: true
-uri: "php://temp"
-customMetadata: []
}
}