waiting-for-dev / warden-jwt_auth

JWT token authentication with warden
MIT License
113 stars 56 forks source link

Add support for configurable token header #55

Closed humesy closed 3 months ago

humesy commented 6 months ago

Summary

Adds the ability to change the header that the JWT token is sent & received through.

This has been in use in conjunction with an update to devise-jwt (will open PR if this one is approved) in a production application for more than 1 year without issue.

Why it was needed When implementing devise-jwt to my platform, an issue was encountered with the 'Authorization' header always being used to transmit the JWT token. This is due to testing environments that use basic HTTP authentication, in which the 'Authorization' header is used for this authentication. This update allowed us to use a different header in our testing environments to avoid conflicting.

How it works If you need a custom header for a reason like the above, set the token_header configuration option. If you do not set an option, it will default to 'Authorization' and so will not affect existing implementations.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed (~cross them out~ if they are not):

humesy commented 5 months ago

Hey @waiting-for-dev, just pinging to make sure you're aware of this :) When you have the time I would love a review, thanks!

waiting-for-dev commented 4 months ago

Hey @humesy, are you willing to follow-up here? 🙂

humesy commented 4 months ago

Hey @waiting-for-dev , sorry I've taken so long to get to this! I appreciate your review and I will make some updates today, thanks!

osikes commented 3 months ago

Very much in support of this, I'm in the same situation. This would 100% solve my problem.

waiting-for-dev commented 3 months ago

Available in v0.10.0

humesy commented 3 months ago

@waiting-for-dev Thanks heaps! I have opened the corresponding PR for devise-jwt here https://github.com/waiting-for-dev/devise-jwt/pull/271