/** @test */ public function it_should_return_false_if_no_token_in_request() { $request = Request::create('foo', 'GET', ['foo' => 'bar']); $parser = new TokenParser($request); $this->assertFalse($parser->parseToken()); $this->assertFalse($parser->hasToken()); }
/** * Parse the token from the request. * * @throws \Tymon\JWTAuth\Exceptions\JWTException * * @return JWTAuth */ public function parseToken() { if (!($token = $this->parser->parseToken())) { throw new JWTException('The token could not be parsed from the request'); } return $this->setToken($token); }