Search code examples
deepstream.io

RPC class without authentication


I'm trying to make a RPC call to a deepstream server, which require authentication, here is the config:

#Authentication
auth:
    type: http
    options:
        endpointUrl: http://localhost:3000/auth-user
        permittedStatusCodes: [ 200 ]
        requestTimeout: 500

And here is the permissions:

rpc:
    "*":
       provide: true
       request: true

The authentication is working fine. But when I try to make a RPC call before calling

client.login()

I keep getting this error: ACK_TIMEOUT, and looking on the websocket frames it doesn't seems that frames/data are sent to the server, is there some client side validation forbidding any interaction with the server before the login call? Is there a way to make an anonymous RPC call then make the login?


Solution

  • deepstream does block all calls before authentication - even for public connections it's required to call login with null or empty arguments first. You could however create a public/open user that the http auth server allows through to make the initial RPC, then immediately disconnect and reconnect with the proper credentials