I have an issue with my laravel 5.8 project..
I want to make registration and get tokens using passport with Guzzle but when i post a new record to get token, i get error saying
"`POST http://femlife.test/oauth/token` resulted in a `401 Unauthorized` response:
{"error":"invalid_credentials","error_description":"The user credentials were incorrect.","message":"The user credential (truncated...)"
Here is my code:
$http = new Client;
$response = $http->post('http://femlife.test/oauth/token', [
'form_params' => [
'grant_type' => 'password',
'client_id' => 2,
'client_secret' => 'gpnQCoxmAxeiW8srk50j5onLiwvRs3dc8aiID3S3',
'username' => $request->name,
'password' => $request->password,
'scope' => '',
'code' => 200,
'redirect_uri' => 'http://localhost'
],
]);
return response(['data'=>json_decode((string) $response->getBody(), true)]);
Please, What am i doing wrong? I saw some suggestions that i have to separate Server and Client instances because now,am using one XAMPP instance..