0

I am new to PHP (Laravel), i am using tymon JWT library. I generated a custom token, now i want a way to verify its signature knowing that the token is not going to be extracted from header or request object it is like a stand alone token ex:eyJ0eXAiOiJK.eyJzddSwsd.C1PCr4D

I am using JWT tokens for other purposes than authentication, so this method of validating credentials wouldn't help or middlewares

    if (! $token = JWTAuth::attempt($credentials)) {
        return Response::json(['error' => 'invalid_credentials'], 401);
    }
Dodz
  • 187
  • 1
  • 6
  • 14
  • Not finding the answer here? https://github.com/tymondesigns/jwt-auth/wiki/Authentication `JWTAuth::setToken('foo.bar.baz');` – ficuscr Jul 16 '18 at 19:04
  • I don't need to set a token, i already have one and need to verify/validate its signature – Dodz Jul 16 '18 at 19:12
  • Yeah, well how do you do that? By passing (i.e. setting) the token and then using the lib to validate that value. "Of course you can also manually set the token aswell, as needed if there are other entry points into your application. e.g."... And then the authentication code is right below that... `JWTAuth::parseToken()->authenticate()` and then cases for the responses, invalid, expired, etc – ficuscr Jul 16 '18 at 19:18
  • That lib is very tied to Laravel authentication. If you want a looser integration maybe look at https://github.com/firebase/php-jwt and use `JWT::decode`. – ficuscr Jul 16 '18 at 19:26
  • Glad you got it sorted! – ficuscr Jul 20 '18 at 18:29

0 Answers0