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

Not picking up new token from a 302 found and redirect #343

Open
colmben opened this issue Dec 28, 2016 · 0 comments
Open

Not picking up new token from a 302 found and redirect #343

colmben opened this issue Dec 28, 2016 · 0 comments

Comments

@colmben
Copy link

colmben commented Dec 28, 2016

I have a rails back end (using devise_token_auth) that is responding to a Create action with a redirect_to the resulting resource. This gives a 302 response to the /resources POST which results in the browser redirecting to the correct /resource/NN GET to access the created resource. I can't remember exactly why I did it like that.

This causes problems for ng-token_auth. The/resources 302 response has a new token in it. The /resource/NN request however uses the same token as the /resources request. I can't see why it does this as it should have the new token as it can't redirect until it has seen the /resources response. This /resource/NN request gets through as it will be within the default batch timing for devise_token_auth. Any subsequent request done after the batch timeout will continue to use the original /resources request token and so fail. I initially thought it might be a devise_token_auth issue but it is looking more and more like it is ng related.

For now I have changed the rails response to respond_with and everything is fine. Any thoughts on why a 302 and redirect has this behaviour would be welcome.

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

1 participant