Skip to content

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

Draft
aguynamedben wants to merge 1 commit into
masterfrom
standard-devise-dont-create-new-client
Draft

aguynamedben wants to merge 1 commit into
masterfrom
standard-devise-dont-create-new-client

Conversation

@aguynamedben

Copy link
Copy Markdown

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