JWT Token is Invalid

I’m using Nowakowskir adhocore JWT PHP library from JWT.io to generate the token:
GitHub - adhocore/php-jwt: Ultra lightweight, dependency free and standalone JSON web token (JWT) library for PHP5.6 to PHP8.0. This library makes JWT a cheese.

$header = array();
		$header['alg'] = 'HS256';
		$header['typ'] = 'JWT';
		$pload = array();
		$pload['iss'] = API_KEY;
		$pload['exp'] = time() + 3600;
		$tokenDec = new Nowakowskir\JWT\TokenDecoded($header,$pload);
		$tokenEncoded = $tokenDec->encode(API_SECRET,'HS256');
		return $tokenEncoded->toString();

The Token apparently generates fine, but when trying to establish an API connection I get an error that the token its Invalid.
{“code”:124,“message”:“Invalid access token.”}

Any idea where its going wrong?
Any help would be appreciated.


Thanks for reaching out!
Have you tried debugging your JTW token to make sure it is valid?
You can debug it here:

Here is the link to our Docs:

Hope this helps

Thanks. Tried using a different Library (Acc/Jwt) and it worked fine. Seems like the Nowakowskir library has some kind of issue during generation.

1 Like

Happy to hear you solved this issue!
Let me know if there is anything else you need from us!
Elisa :slight_smile: