/** * Generate a new Token instance * * @param Boolean $remember * * @return Vercoutere\LaravelJwt\Token */ protected function generateNewToken($remember = false) { return Token::generate('*****@*****.**', $remember); }
/** * Authenticates and logs a user in from a token. * * @param String $token * * @return Boolean */ public function authenticateWithToken($token) { try { $token = Token::validate($token); } catch (InvalidTokenException $e) { return false; } $this->token = $token; // Retrieve the user from the handle in the token. $user = $this->provider->retrieveByCredentials([config('jwt.handle') => $token->getPayload()['aud']]); $this->login($user); return true; }