Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: validate JWT tokens #609

Closed
renatoargh opened this issue Dec 1, 2016 · 2 comments
Closed

Feature request: validate JWT tokens #609

renatoargh opened this issue Dec 1, 2016 · 2 comments

Comments

@renatoargh
Copy link

renatoargh commented Dec 1, 2016

I am asking for a feature not to decode the token but to check if a string is a jwt token.

I am not sure the best way to achieve this but I know that jwt tokens are formed by three base64 encoded strings separated by dots, this would be the simplest validation I suppose.

Thank you for the awesome work! :)

@IOAyman
Copy link
Contributor

IOAyman commented Dec 1, 2016

That would be a good validator 👍
The validation mechanisme of a JWT is well described in the RFC7519.

I'll submit a PR if I find some time in the weekend

@christiaanwesterbeek
Copy link

christiaanwesterbeek commented May 2, 2018

This is the simplified assertion I'm using currently:

assert.ok(/^[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+\.[a-zA-Z0-9\-_]+$/.test(thing), 'is a valid jwt token')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants