0

I have generated JWT token. I added it as String argument in one method I have to call. Is there a way to validate that String token if it is expired, valid, etc?

crazyDev
  • 1
  • 1

1 Answers1

1

Salesforce does provide Apex support for JWS/JWT:

https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Auth_JWS.htm

-and-

https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_Auth_JWT.htm

Although unfortunately the JWS class only supports generating signatures and not verifying them. However you can verify the signature yourself:

Using the Crypto.verify() method to verify a JWT signature

Once you've verified that the payload is valid, then you can examine any of the Claims to make sure that they are acceptable.

Matt Comer
  • 36
  • 4