Reputation: 848
https://www.chatwoot.com is open source chat solution provider app. Developed in Rails and Vuejs. It's using DeviseTokenAuth gem for authentication.
I want the current_user to work on both Vue side and Rails view side. So If I'm using token based authentication, it should work on both side.
Or When I login as DeviseTokenAuth, it should login into devise and when I logout from DeviseTokenAuth it should logout from Devise gem side as well.
Right now if I'm using include DeviseTokenAuth::Concerns::SetUserByToken
and having no user at all when I access a action that endup with Rails view, I know I'm logging in into system from Vue side, but is there something I can do to have both on same state of authentication.
But same time if I don't include DeviseTokenAuth::Concerns::SetUserByToken
I will get current_user
even when I'm logged out which is given on Vue side and pointing action destroy
of DeviseTokenAuth::SessionsController
So it's complex to understand how the cookies being handled when I'm not handling cookies in Rails view explicitly while I'm handling Cookies using cookies yarn library on Vue side.
All I want is to be on same page even if I'm on Rails view related controller or Vuejs view. And if I'm using Devise based authentication for some part and devisetokenauth based authentication for other part.
Can those scenarios be in sync with each other. I also have added this points in discussion on original repository. Here is the URL. https://github.com/chatwoot/chatwoot/discussions/1928
If anyone think they can make this question easy to understand and still explains the situation, most welcome!
Any help would be appreciated. 🙏🏻
Thanks!
Upvotes: 1
Views: 581