In my application APIGEE is used as the authentication layer for users. We are using JWT token as means for authentication at service end. There is a requirement such that if the user logs out and the JWT token is not expired, then the application should call the APIGEE edge for the invalidation of the JWT issued earlier.
Is there any way to achieve this scenario?
Solved! Go to Solution.
JWT Cannot be invalidated. I have written about this elsewhere.
You can sort of simulate invalidation of a JWT, for a particular verifying party, by storing the JWT ID (jti claim) or equivalent, into a "revoked" list. For example, in a cache stored in Apigee Edge using the PopulateCache policy. Use a TTL that is longer than the JWT Expiry. (This will not work well if the JWT does not have an expiry!)
Then, to verify the JWT, you would need 2 steps in your API Proxy flow:
Any other party that verifies the JWT will not consider it to be revoked.
Darpan, I have handled JWT in the past within a MEAN Stack App. It was a PoC and security was not a high priority so I have used cookies to handle JWT. When the user logs out, I used to simply clear the cookie.
Dino that is a good solution for indirectly revoking a JWT in some exceptional cases. I have built a sample proxy based on your steps. Can you please explain why the PopulateCache should have a longer TTL than the JWT Expiry?