-
Notifications
You must be signed in to change notification settings - Fork 27
Remove the need to verify the token per request #17
Remove the need to verify the token per request #17
Conversation
Any chances of this getting merged in soon? |
@IamFlowZ Thanks for the PR! I like the idea but I'm a little concerned that with this approach a user could mistakenly forget to set the How about if we required another environment variable to be set, like
|
@johnymontana if (typeof JWT_SECRET === 'boolean') {
// check the value if false return jwt.decode(id_token)
} else {
// normal stuff like
if (!JWT_SECRET) {
throw new Error(
'No JWT secret set. Set environment variable JWT_SECRET to decode token.'
);
}
} This way if we want to ignore the decoding we just set the same env variable to false. |
I agree that a flag plus the value is the better way to go. I think the typeof would be more negotiable, if we were working with pure javascript values. In node, unset environment variables return undefined. While undefined is still falsy it's probably better design to provide an explicit switch rather than an implicit type check. I will try to add this thought in this weekend. Thanks for the feedback :D |
@johnymontana I've added that environment variable as well as a bit at the end of the readme about how to run the tests locally so as not to eat up circleci credits. If there's any other changes you'd like to set let me know. Thanks!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 👏
Great - thanks! |
Description
This small change enables the user to optionally set the JWT_SECRET environment variable.
Related Issue
Support for federated services
Motivation
I'm working on a project that leverage's AWS Cognito for user identities, and so I don't have access to the original key that is used to generate the token. It would be nice if there was functionality that allowed for tokens to be accepted even if they are unverified within this instance.