Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Branch development (ad65b0)
by José
04:05
created

AuthenticateController::authenticate()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 21
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 9.3142
c 0
b 0
f 0
cc 3
eloc 10
nc 4
nop 1
1
<?php
2
3
namespace DoeSangue\Http\Controllers\Auth;
4
5
use JWTAuth;
6
use Tymon\JWTAuth\Exceptions\JWTException;
7
use DoeSangue\Http\Controllers\Controller;
8
use Illuminate\Http\Request;
9
use DoeSangue\Http\Requests;
10
use DoeSangue\Models\User;
11
12
class AuthenticateController extends Controller
13
{
14
    public function authenticate(Request $request)
15
    {
16
        // grab credentials from the request
17
        $credentials = $request->only('email', 'password');
18
19
        try {
20
            // attempt to verify the credentials and create a token for the user
21
            if (! $token = JWTAuth::attempt($credentials)) {
22
                return response()->json(['error' => 'invalid_credentials'], 401);
23
            }
24
        } catch (JWTException $e) {
25
            // something went wrong whilst attempting to encode the token
26
            return response()->json(['error' => 'could_not_create_token'], 500);
27
        }
28
29
        // all good so return the token
30
        return response()->json([
31
          'access_token' => $token,
32
          'token_type' => 'bearer'
33
        ]);
34
    }
35
}
36