Comments (1)
I found the solution
I send slug_id with the uid, access_token and client for subscribing to the channel and I use it in connection.rb like this
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
uid = request.query_parameters[:uid]
token = request.query_parameters[:token]
client_id = request.query_parameters[:client]
slug_id = request.query_parameters[:slug_id]
user = User.where(slug_id: slug_id).find_by_uid(uid) <-------- get all users with the same slug_id :)
if user && user.valid_token?(token, client_id)
user
else
reject_unauthorized_connection
end
end
end
end
from angular2-actioncable.
Related Issues (12)
- way to confirm channel subscription HOT 3
- Update to Angular 10
- sink._addParentTeardownLogic is not a function when using pipe() HOT 1
- Reconnect to channel HOT 1
- No way to send / broadcast to a particular event HOT 3
- this.baseCable.close is not a function HOT 2
- Make it possible for params to return a Promise HOT 4
- /node_modules/rxjs/Observable has no exported member 'Observable' HOT 1
- perform doesn't sent data properly? HOT 5
- Error when subscription is rejected HOT 2
- Passing authentication header HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular2-actioncable.