dusterio / lumen-passport

Making Laravel Passport work with Lumen
MIT License
654 stars 139 forks source link

Receiving 500 code error only. #141

Closed pat22292 closed 2 years ago

pat22292 commented 4 years ago

Before anything else, I've been using this package for almost 5 years and I thank you for that, then I tried it with lumen version 7 , .

public function login(Request $request) { $http = new \GuzzleHttp\Client;

    try {
        $response = $http->post(config('services.passport.login_endpoint'), [
            'form_params' => [
                'grant_type' => 'password',
                'client_id' => config('services.passport.client_id'),
                'client_secret' => config('services.passport.client_secret'),
                'username' => $request->email,
                'password' => $request->password,
                'scope' => '*'
            ]
        ]);
        return $response->getBody();

    } catch (\GuzzleHttp\Exception\BadResponseException $e) {
        return $e->getCode();

    }
}

Whenever I try to generate token with correct credentials, It is working just fine, but when Catching the errors, I noticed that I'm only getting 500 code? I included this as an issue because my previous projects doesn't give me any problem at all, just now.

dusterio commented 4 years ago

@pat22292 I'm going to check tomorrow!

pat22292 commented 4 years ago

@pat22292 I'm going to check tomorrow!

pat22292 commented 4 years ago

@pat22292 I'm going to check tomorrow!

Okay Sir, Noted.

pat22292 commented 4 years ago

{ "message": "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.", "code": 10, "status_code": 500 }

By the way, here's the response.

Salman98 commented 3 years ago

@pat22292 make sure you have add this line Passport::hashClientSecrets(); in AppServiceProvider

faris-mig commented 2 years ago

@pat22292 Did you solve it? I got the same error