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

Completed
Push — development ( bf19a3...ad65b0 )
by José
08:52
created

AuthenticateController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A authenticate() 0 21 3
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