Completed
Push — master ( 283619...3a9db8 )
by Eric
04:07
created

PasswordGrantProxyController::issueToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 22
rs 9.2
cc 1
eloc 11
nc 1
nop 1
1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Http\Requests\PasswordGrantProxyControllerRequest;
0 ignored issues
show
Bug introduced by
The type App\Http\Requests\Passwo...tProxyControllerRequest was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use GuzzleHttp\Client;
7
use Illuminate\Support\Facades\DB;
8
9
/**
10
 * Class PasswordGrantProxyController.
11
 *
12
 * @package App\Http\Controllers
13
 */
14
class PasswordGrantProxyController extends Controller
15
{
16
    /**
17
     * @return mixed
18
     */
19
    public function issueToken(PasswordGrantProxyControllerRequest $request)
20
    {
21
        $http = new Client;
22
23
        $client = DB::table('oauth_clients')->where('id', 2)->first();
24
25
//        dump($request->username);
26
//        dump($request->password);
27
//        dump($client->redirect);
28
29
        $response = $http->post(url('http://tasks.test/oauth/token'), [
30
            'form_params' => [
31
                'grant_type' => 'password',
32
                'client_id' => $client->id,
33
                'client_secret' => $client->secret,
34
                'username' => $request->username,
35
                'password' => $request->password,
36
                'scope' => '',
37
            ],
38
        ]);
39
40
        return json_decode((string) $response->getBody(), true);
41
    }
42
}
43