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

Problem when using 2 types of authentication on same site #334

Open
shartep opened this issue Apr 13, 2018 · 0 comments
Open

Problem when using 2 types of authentication on same site #334

shartep opened this issue Apr 13, 2018 · 0 comments
Labels
support request This issue is a request for support using Simple Token Authentication.

Comments

@shartep
Copy link

shartep commented Apr 13, 2018

Can somebody explain why we need if condition in this line

throw(:warden, scope: entity.name_underscore.to_sym) if controller.send("current_#{entity.name_underscore}").nil?
?

Here is my case: I working on web site, it have admin panel (active_admin) and I use classic devise solution for authentication via session. Other part of is a single-page application, so I start implementing REST API on backend for support this SPA. I decide to use token base authentication for REST API part, add acts_as_token_authentication_handler_for User, fallback: :exception

So I login via classic devise sign_in view, then generate token and send it to SPA.

When I make requests from SPA to my REST API with wrong credentials this request are still OK, it happens because exception is not throws in this line (see link above), reason of this is that controller.send("current_#{entity.name_underscore}") return User instance, because request from client also include cookies with session_id.

@gonzalo-bulnes gonzalo-bulnes added the support request This issue is a request for support using Simple Token Authentication. label Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support request This issue is a request for support using Simple Token Authentication.
Projects
None yet
Development

No branches or pull requests

2 participants