php - Laravel passport oauth/authorize error -
i'm trying use passport using oauth/authorize in order allow web application code , request token later, i'm getting error
route [login] not defined
below code.
client code
// first route user visits on consumer app route::get('/', function () { // build query parameter string pass auth information our request $query = http_build_query([ 'client_id' => 3, //'client_secret' => 'mtkembl0f0bf4lcepcobus0wlhvf5xqqchhcpath', 'redirect_uri' => 'http://client.app:8082/callback', 'response_type' => 'code', 'scope' => '' ]); // redirect user oauth authorization page return redirect('http://server.app:8082/oauth/authorize?' . $query); }); // route user forwarded after approving on server route::get('/callback', function (request $request) { return 'test 2'; $http = new guzzlehttp\client; $response = $http->post('http://server.app:8082/oauth/token', [ 'form_params' => [ 'grant_type' => 'authorization_code', 'client_id' => 3, // admin panel above 'client_secret' => 'mtkembl0f0bf4lcepcobus0wlhvf5xqqchhcpath', // admin panel above 'redirect_uri' => 'http://client.app:8082/callback', 'code' => $request->code // code callback ] ]); // echo access token; save in db return json_decode((string) $response->getbody(), true)['access_token']; });
maybe have more 1 error. looks forgot define common auth routes. start php artisan make:auth
or auth::routes()
. oauth routes doesn't have login
route, error you've got says didn't define login
route. defined in auth::routes()
actually.
Comments
Post a Comment