Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Unable to authenticate requests when using vanilla Socket.IO #166
I’m trying to use Feathers with a native Android app. The code below is JS code (To make sure it is possible)
From the docs
This means that any subsequent events I emit from the client will be authenticated. I tried this
But the code above doesn't work and returns the following error -
What am I doing wrong?
The problem with your socket.io code is that on the client you need to first
If you are looking for native Android, @corymsmith has been working on a client that should be out soon. Might want to just wait for that
I'm going to close this because it's not a problem with auth and a first cut of the Android client should be up within a couple weeks.
I'll add that, if anything, it's a lack of documentation on how to authenticate using socket.io, but again that's low priority for us because we encourage the use of the Feathers client libs and if need be you'll have to just look at the code. We'd basically just be pasting the code in the docs.
I haven't made any changes to the server side (using the standard code from FeathersJS quick start code).
I'm not sure what you mean by -
How do I send requests using the authenticated socket? I'm already emitting an authenticate event on connect event.
Also, unfortunately I can't wait for the android client to be released as I'm trying to use Feathers for a small real-time project which I need to complete this week itself.
@ekryski Thanks a lot for this!!! You're awesome.
I also found I was facing the same issue as mentioned in this comment - feathersjs/feathers-chat#14 (comment)
After changing the idField to "_id" my code works.
Apparently, the generator doesn't set the field to _id for NeDB and MongoDB. I will try and send a fix for this issue.
Thanks a ton for your help. This is what makes the project so great!