jeudi 28 juin 2018

Laravel Passport Auth Stuck when run on standalone project for password based token authentication

Laravel Passport Auth Stuck when run on self server and client in same project for password based token authentication

LoginController

public function authenticaterrr(Request $request)

{
     $http = new Client();

    try{
                //dd("Hello");

        $response = $http->post(url('oauth/token'), [
        'form_params' => [
            'grant_type' => 'password',
            'client_id' => '2',
            'client_secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
            // 'username' => $request->get('username'),
            // 'password' => $request->get('password'),
              'username' => 'xxxxxx@xxxxx.com',
                'password' => 'xxxxx',
            'scope'     => '*',
         ],
         ]);

       //  $apiResponse = json_decode((string) $response->getBody(), true);

       // dd($apiResponse);
         $apiResponse = json_decode((string) $response->getBody(), true);

        dd($apiResponse);
        session(['api'=> $apiResponse]);
        session(['api-token'=> $apiResponse['access_token']]);
        return json_decode($response->getBody(), true);
    }catch (ClientException $exception){
        dd("Hello");
        return json_decode($exception->getResponse()->getBody(), true);
    }
}

IN Web.php

Route::get('/auth/api/validate', 'Auth\LoginController@authenticaterrr');

In PostMan It didn't Get and Stuck Here is Output

If i will create new Project and Use that than it will work for me so what would be solution to run in same project



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Ncht6i
via IFTTT

Aucun commentaire:

Enregistrer un commentaire