Auth0\SDK\Token
class used for processing (JWT). It enables you to decode, validate and verify tokens for use by your application. More information on JWTs and how to build and decode them can be found jwt.io.
The class can process both HS256 and RS256 tokens. Both types require the algorithm and valid audiences to be configured with the SDK before processing. HS256 tokens require the to be configured. RS256 tokens require an authorized issuer, which is used to fetch a JWKs file during the decoding process. (More about signing algorithms here.)
Prerequisites
The documentation below assumes that you followed the steps in the PHP getting started guide, and continue off from the code provided there.Example Usage
The following is an example of a small, URL-based JSON Web Token processor based on the SDK’sToken
class.
verify()
and validate()
offer a number of options arguments that can be used to customize their behavior, including validating claims, restricting maximum time since a token’s auth_time
, leeway
clock tolerance for time checks, and more. These methods are fully commented for review of these options either via the source code or your IDE of choice.