getParsedBody()['username']; //get user $user = User::where('email', '=', $username)->firstOrFail(); //issuetoken $tokenResponse = parent::issueToken($request); //convert response to json string $content = $tokenResponse->getBody()->__toString(); //convert json to array $data = json_decode($content, true); if(isset($data["error"])) throw new OAuthServerException('The user credentials were incorrect.', 6, 'invalid_credentials', 401); //add access token to user $user = collect($user); $user->put('access_token', $data['access_token']); return Response::json(array($user)); } catch (ModelNotFoundException $e) { // email notfound //return error message } catch (OAuthServerException $e) { //password not correct..token not granted //return error message } catch (Exception $e) { ////return error message } } }