{"action":"opened","issue":{"url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/463","labels_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/463/labels{/name}","comments_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/463/comments","events_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/463/events","html_url":"https://github.com/lucadegasperi/oauth2-server-laravel/issues/463","id":94977223,"number":463,"title":"How to add a new custom grant type?","user":{"login":"beznez","id":8573406,"avatar_url":"https://avatars.githubusercontent.com/u/8573406?v=3","gravatar_id":"","url":"https://api.github.com/users/beznez","html_url":"https://github.com/beznez","followers_url":"https://api.github.com/users/beznez/followers","following_url":"https://api.github.com/users/beznez/following{/other_user}","gists_url":"https://api.github.com/users/beznez/gists{/gist_id}","starred_url":"https://api.github.com/users/beznez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beznez/subscriptions","organizations_url":"https://api.github.com/users/beznez/orgs","repos_url":"https://api.github.com/users/beznez/repos","events_url":"https://api.github.com/users/beznez/events{/privacy}","received_events_url":"https://api.github.com/users/beznez/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-14T15:52:41Z","updated_at":"2015-07-14T15:52:41Z","closed_at":null,"body":"I want to add a new custom grant type. This grant type should be called `guest` and it is needed so I can keep track of a guest cart without a user being required to register and login. I added this to `config/oauth2.php`:\r\n\r\n```php\r\n'guest' => [\r\n            'class' => '\\League\\OAuth2\\Server\\Grant\\PasswordGrant',\r\n            'callback' => '\\App\\Verifier@guest',\r\n            'access_token_ttl' => 3600\r\n        ],\r\n```\r\n\r\nAnd in `Verifier` I added my `guest` method:\r\n\r\n```php\r\npublic function guest($guest_token, $password = null)\r\n    {\r\n        \\Log::info('guest grant has fired!');\r\n    }\r\n```\r\n\r\nThen I used curl to get an access token:\r\n\r\n```curl\r\ncurl \"http://domain.com/oauth/accessToken\" -d \"grant_type=guest\"\r\n```\r\n\r\nAnd I receive this error:\r\n\r\n```sh\r\n[2015-07-14 15:36:52] local.ERROR: exception 'League\\OAuth2\\Server\\Exception\\UnsupportedGrantTypeException' with message 'The authorization grant type \"guest\" is not supported by the authorization server.' in /var/www/html/universal_menudrive_api/vendor/league/oauth2-server/src/AuthorizationServer.php:271\r\nStack trace:\r\n#0 /var/www/html/universal_menudrive_api/vendor/lucadegasperi/oauth2-server-laravel/src/Authorizer.php(80): League\\OAuth2\\Server\\AuthorizationServer->issueAccessToken()\r\n#1 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(207): LucaDegasperi\\OAuth2Server\\Authorizer->issueAccessToken()\r\n#2 /var/www/html/universal_menudrive_api/app/Http/routes.php(39): Illuminate\\Support\\Facades\\Facade::__callStatic('issueAccessToke...', Array)\r\n#3 /var/www/html/universal_menudrive_api/app/Http/routes.php(39): LucaDegasperi\\OAuth2Server\\Facades\\Authorizer::issueAccessToken()\r\n#4 [internal function]: Uma\\Providers\\RouteServiceProvider->{closure}()\r\n#5 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Routing/Route.php(155): call_user_func_array(Object(Closure), Array)\r\n#6 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Routing/Route.php(130): Illuminate\\Routing\\Route->runCallable(Object(Illuminate\\Http\\Request))\r\n#7 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Routing/Router.php(704): Illuminate\\Routing\\Route->run(Object(Illuminate\\Http\\Request))\r\n#8 [internal function]: Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))\r\n#9 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))\r\n#10 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))\r\n#11 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))\r\n#12 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Routing/Router.php(706): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))\r\n#13 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Routing/Router.php(671): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))\r\n#14 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Routing/Router.php(631): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))\r\n#15 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(229): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))\r\n#16 [internal function]: Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))\r\n#17 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))\r\n#18 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(54): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))\r\n#19 [internal function]: Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))\r\n#20 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)\r\n#21 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(62): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))\r\n#22 [internal function]: Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))\r\n#23 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)\r\n#24 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))\r\n#25 [internal function]: Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))\r\n#26 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)\r\n#27 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))\r\n#28 [internal function]: Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))\r\n#29 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)\r\n#30 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(42): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))\r\n#31 [internal function]: Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))\r\n#32 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)\r\n#33 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))\r\n#34 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))\r\n#35 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(118): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))\r\n#36 /var/www/html/universal_menudrive_api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(86): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))\r\n#37 /var/www/html/universal_menudrive_api/public/index.php(54): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))\r\n#38 {main}\r\n```\r\n\r\nDid I miss a step?"}}