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

Auhorization for verified users #19

Closed
lentrup opened this issue Apr 21, 2022 · 1 comment
Closed

Auhorization for verified users #19

lentrup opened this issue Apr 21, 2022 · 1 comment

Comments

@lentrup
Copy link

lentrup commented Apr 21, 2022

I noticed that the gem only works when I am logged in. I am using devise.
Maybe we can add a hint that one needs to modify connection.rb or add something to the initializer of the gem?
connection.rb :

module ApplicationCable
  class Connection < ActionCable::Connection::Base
    identified_by :current_user

    def connect
      self.current_user = find_verified_user
    end

    private

    def find_verified_user
      if verified_user = env['warden'].user
        p verified_user
        verified_user
      else
        p verified_user
        reject_unauthorized_connection
      end
    end
  end
end
@kirillplatonov
Copy link
Owner

The gem uses separate ActionCable server now. This should fix the issue:
#69

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

2 participants