D
D
Dmitry Sudarkin2018-10-19 17:58:58
Laravel
Dmitry Sudarkin, 2018-10-19 17:58:58

Why does a POST request give an error?

Hello!
Trying to send request from Laravel application controller using GuzzleHttp client like this

$client = new Client();
$res = $client->post('http://auth.dev/oauth/token', [
  'form_params' => [
    'grant_type' 	=> $this->grant_type,
    'client_secret'  => $this->client_secret,
    'client_id' 	=> $this->client_id,
    'username' 	=> $data['login'],
    'password' 	=> $data['password'],
  ]
]);

The request happens to a third party service but asks for oauth_clients
Server error: `POST http://auth.dev/oauth/token` resulted in a `500 Internal Server Error` response:\n
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'gate.oauth_clients' doesn't exist (SQL: select * from `oau (truncated...)\n

According to the idea, I should get a token
. If I test through Postman, then everything works correctly. I get what I need
{
    "token_type": "Bearer",
    "expires_in": 31536000,
    "access_token": "...",
    "refresh_token":"..."
}

Am I sending the request from the app incorrectly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Sudarkin, 2018-10-19
@GrozInventor

Decided! Port problem. If the services are on different servers, everything works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question