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

Add config to not create new clients on standard Devise requests #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aguynamedben
Copy link

DO NOT MERGE: Just making a PR so it's easy to see what we've customized.

If enable_standard_devise_support is true, XHR requests that rely
on standard Devise authentication (i.e. a logged in session) seemed to
inadvertently create new client instances. This meants if you have a
high volume of XHR requests to an ApplicationController that uses
devise_token_auth, if those clients don't respect/use the
devise_token_auth headers, soon those clients will cause
devise_token_auth to rotate out all its tokens, leaving other clients
with invalid tokens.

This adds a config standard_devise_dont_create_new_client that
defaults to false (previous behavior), but if you want XHR requests
using standard Devise to not rotate clients/tokens, setting
standard_devise_dont_create_new_client will return early, before
devise_token_auth gets to the token rotation.

If `enable_standard_devise_support` is `true`, XHR requests that rely
on standard Devise authentication (i.e. a logged in session) seemed to
inadvertently create new client instances. This meants if you have a
high volume of XHR requests to an ApplicationController that uses
devise_token_auth, if those clients don't respect/use the
devise_token_auth headers, soon those clients will cause
devise_token_auth to rotate out all its tokens, leaving other clients
with invalid tokens.

This adds a config `standard_devise_dont_create_new_client` that
defaults to `false` (previous behavior), but if you want XHR requests
using standard Devise to not rotate clients/tokens, setting
`standard_devise_dont_create_new_client` will return early, before
devise_token_auth gets to the token rotation.
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

Successfully merging this pull request may close these issues.

1 participant