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

JWT in cookies? #12

Closed
mpoisot opened this issue Jul 1, 2019 · 1 comment
Closed

JWT in cookies? #12

mpoisot opened this issue Jul 1, 2019 · 1 comment

Comments

@mpoisot
Copy link

mpoisot commented Jul 1, 2019

Is there an easy way to have rack-jwt read the token from cookies headers instead of just Bearer?

I read several articles and discussions about where to store securely JWTs, and it appears the consensus is don't store in localstorage, instead use cookies with secure flags.

@buszu buszu mentioned this issue Apr 1, 2020
nashby added a commit that referenced this issue Sep 30, 2023
This PR adds a new auth option: cookie. To enable it you need to set `token_location` option as:

```
use Rack::JWT::Auth, { token_location: { cookie: 'COOKIE_NAME' } }

```

By default rack-jwt will keep using `:header` token location option so there're no change required
after this PR is merged. If you want to explicitly set the token location to `:header`:

```
use Rack::JWT::Auth, { token_location: :header }

```

closes #21 #12
nashby added a commit that referenced this issue Sep 30, 2023
This PR adds a new auth option: cookie. To enable it you need to set `token_location` option as:

```
use Rack::JWT::Auth, { token_location: { cookie: 'COOKIE_NAME' } }

```

By default rack-jwt will keep using `:header` token location option so there're no change required
after this PR is merged. If you want to explicitly set the token location to `:header`:

```
use Rack::JWT::Auth, { token_location: :header }

```

closes #21 #12
@nashby
Copy link
Collaborator

nashby commented Sep 30, 2023

closed by #32

@nashby nashby closed this as completed Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants