{"action":"created","issue":{"url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/273","labels_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/273/labels{/name}","comments_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/273/comments","events_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/273/events","html_url":"https://github.com/lucadegasperi/oauth2-server-laravel/issues/273","id":52848692,"number":273,"title":"Check \\\"grant type\\\" parameter","user":{"login":"dtirer","id":639812,"avatar_url":"https://avatars.githubusercontent.com/u/639812?v=3","gravatar_id":"","url":"https://api.github.com/users/dtirer","html_url":"https://github.com/dtirer","followers_url":"https://api.github.com/users/dtirer/followers","following_url":"https://api.github.com/users/dtirer/following{/other_user}","gists_url":"https://api.github.com/users/dtirer/gists{/gist_id}","starred_url":"https://api.github.com/users/dtirer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtirer/subscriptions","organizations_url":"https://api.github.com/users/dtirer/orgs","repos_url":"https://api.github.com/users/dtirer/repos","events_url":"https://api.github.com/users/dtirer/events{/privacy}","received_events_url":"https://api.github.com/users/dtirer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-12-25T05:42:12Z","updated_at":"2015-01-04T03:23:41Z","closed_at":null,"body":"I'm trying to setup OAuth with an API I'm building.  I'm using the Password grant and my OAuth2.php file looks as follows:\r\n\r\n`'grant_types' => [\r\n        'password' => [\r\n            'class'            => 'League\\OAuth2\\Server\\Grant\\PasswordGrant',\r\n            'callback'         => function($username, $password)\r\n            {\r\n                $credentials = [\r\n                    'email'    => $username,\r\n                    'password' => $password,\r\n                ];\r\n                if (Auth::once($credentials)) {\r\n                        return Auth::user()->id;\r\n                    } else {\r\n                        return false;\r\n                    }\r\n            }\r\n        ],\r\n    ],`\r\n\r\nI then have a basic route setup to test it (as per the docs)\r\n\r\n`Route::post('oauth/access_token', function() {\r\n    return Response::json(Authorizer::issueAccessToken());\r\n\r\n});`\r\n\r\nI'm using Postman to test the API.  I enter the URL / Route, and i choose x-www-form-urlencoded in Postman, and set the 2 parameters (email & password) to valid credentials that are in the DB.  However, I always get this error:\r\n\r\n`{\"error\":\"invalid_request\",\"error_description\":\"The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the \\\"grant_type\\\" parameter.\"}`\r\n\r\nPlease advise, thanks."},"comment":{"url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/comments/68619365","html_url":"https://github.com/lucadegasperi/oauth2-server-laravel/issues/273#issuecomment-68619365","issue_url":"https://api.github.com/repos/lucadegasperi/oauth2-server-laravel/issues/273","id":68619365,"user":{"login":"ahsenx","id":8620059,"avatar_url":"https://avatars.githubusercontent.com/u/8620059?v=3","gravatar_id":"","url":"https://api.github.com/users/ahsenx","html_url":"https://github.com/ahsenx","followers_url":"https://api.github.com/users/ahsenx/followers","following_url":"https://api.github.com/users/ahsenx/following{/other_user}","gists_url":"https://api.github.com/users/ahsenx/gists{/gist_id}","starred_url":"https://api.github.com/users/ahsenx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahsenx/subscriptions","organizations_url":"https://api.github.com/users/ahsenx/orgs","repos_url":"https://api.github.com/users/ahsenx/repos","events_url":"https://api.github.com/users/ahsenx/events{/privacy}","received_events_url":"https://api.github.com/users/ahsenx/received_events","type":"User","site_admin":false},"created_at":"2015-01-04T03:23:41Z","updated_at":"2015-01-04T03:23:41Z","body":"I am trying to use it as a plugin, so once plugin is registered it writes the config in memory, \r\n\r\n```\r\nclass OAuth2ServiceProvider extends ServiceProvider\r\n{\r\n...\r\n...\r\n...\r\n$this->app['config']['lucadegasperi/oauth2-server-laravel::oauth2.grant_types.password.callback'] = function ($username, $password)\r\n        {\r\n            try {\r\n                $user = Sentry::findUserByCredentials(['email' => $username]);\r\n\r\n                if(!$user->checkPassword($password))\r\n                    return false;\r\n\r\n                return $user->id;\r\n\r\n            } catch (\\Cartalyst\\Sentry\\Users\\UserNotFoundException $e) {\r\n                return false;\r\n            }\r\n        };\r\n```\r\n\r\nand i am getting the same error\r\n\r\n```{\"error\":\"unsupported_grant_type\",\"error_description\":\"The authorization grant type \\\"password\\\" is not supported by the authorization server.\"}```\r\n\r\nAny idea what i am missing?"}}