I am new in Laravel Passport and installed and configured with official documentation.
public function register(){
$password = Hash::make('demo');
$user = DB::table('users')->insertGetId([
'name' => 'User',
'email' => 'userdev@gmail.com',
'password' => $password,
]);
// create oauth client
$oauth_client = \App\OauthClient::create([
'user_id' => $user,
'name' => 'User',
'secret' => base64_encode(hash_hmac('sha256',$password, 'secret', true)),
'password_client' => 1,
'personal_access_client' => 0,
'redirect' => '',
'revoked' => 0,
]);
$response = ['status'=>200,'message'=>'Successfully Registered'];
return $response;
I just run the API throgh postman and its getting response as Successfully Registered
After that I just called the http://localhost/passport/oauth/token route to authenticate the user. But its not working. Its returning like..
Postdata :
grant_type:password
client_id :1
client_secret:j7q0ky8chHQ0RHJFpWo4Lqn/hl7Z0ntzYeyzsXE9ULA=
username:userdev@gmail.com
password:demo
scope:
Response :
{
"error": "invalid_request",
"message": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.",
"hint": "Check the `client_id` parameter"
}