/** @test */ public function it_invalidates_old_tokens() { $this->setExpectedException('Vercoutere\\LaravelJwt\\Exceptions\\InvalidTokenException'); $this->token->renew(); Token::validate($this->token->getToken()); }
/** * 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; }