Skip to main content
Download the JWT Authentication for CoCart plugin to use these filters.
Each filter is documented below with its description and usage example.

Authentication filters

cocart_jwt_auth_issued_at

Made available since v2.0.0
Allows you to change the token issuance timestamp (iat claim) for token timing synchronization.

cocart_jwt_auth_issuer

Made available since v2.0.0
Allows you to change the token issuer (iss claim) for multi-site setups or custom API endpoints.

cocart_jwt_auth_not_before

Made available since v2.0.0
Allows you to set when the token becomes valid (nbf claim) for token activation control.

cocart_jwt_auth_expire

Made available since v2.0.0
Allows you to customize when the token will expire (exp claim) based on roles or conditions.

cocart_jwt_auth_algorithm

Made available since v2.0.0
vAllows you to change the algorithm used for token signing.

cocart_jwt_auth_token_user_data

Made available since v2.2.0
Allows additional user data to be applied to the payload before the token is generated.

Refresh Token Filters

cocart_jwt_auth_refresh_token_generation

Made available since v2.0.0
Allows you to change how refresh tokens are generated.

cocart_jwt_auth_refresh_token_expiration

Made available since v2.0.0
Allows you to customize refresh token lifetime based on roles or conditions.

Token Management

cocart_jwt_auth_revoke_tokens_on_email_change

Made available since v2.3.0
Allows you to control token revocation on email changes.

cocart_jwt_auth_revoke_tokens_on_password_change

Made available since v2.3.0
Allows you to control token revocation on password changes for security policies.

cocart_jwt_auth_revoke_tokens_on_after_password_reset

Made available since v2.3.0
Allows you to control token revocation on password reset for security policies.

cocart_jwt_auth_revoke_tokens_on_profile_update

Made available since v2.3.0
Allows you to control token revocation on profile update.

cocart_jwt_auth_revoke_tokens_on_delete_user

Made available since v2.3.0
Allows you to control token revocation when a user is deleted.

cocart_jwt_auth_revoke_tokens_on_wp_logout

Made available since v2.3.0
Allows you to control token revocation when a user logs out.
All filters follow WordPress coding standards and can be used with the standard add_filter() function. The examples above show practical implementations for each filter.

cocart_jwt_auth_token_prefix

Made available since v2.5.0
This prefix is used to identify the token type. It can be useful if you want to use different token types or to avoid conflicts with other JWT implementations.
It is NOT required to use a prefix, but it can help to distinguish tokens from different sources or implementations so use a unique prefix.

cocart_jwt_auth_max_user_tokens

Made available since v3.0.0
Allows changing the maximum number of tokens a user can have. Default is 5 tokens.