Skip to content

Verify exp claim without verifying jwt #281

@jamesstonehill

Description

@jamesstonehill

There is no way to verify the exp claim without verifying the JWT. It would be nice to be able to verify a specific claim.

exp = Time.now.to_i - 4 * 3600
exp_payload = { exp: exp }

token = JWT.encode exp_payload, 'asdf', 'HS256'

# This does not verify the expiration
decoded_token = JWT.decode token, nil, false, { verify_expiration: true }

decoded_token = JWT.decode token, nil, true, { verify_expiration: true }
# => No verification key available (JWT::DecodeError)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions