1

I can close the connection with ds.close() but as soon as I run ds.login() I get logged in as the same user, regardless of the credentials provided.

ds.login({user: 'admin', pass: 'admin'})
// AUTH_SUCCESSFUL | admin

ds.close()
// CLIENT_DISCONNECTED | admin

ds.login({})
// INCOMING_CONNECTION | from http://localhost:3000/ (127.0.0.1) via engine.io
// AUTH_SUCCESSFUL | admin

Even if I create a new deepstream client instance before logging in again, the user does not change.

demux
  • 4,544
  • 2
  • 32
  • 56

2 Answers2

1

Actually, closing the connection, and creating a new instance seems to do the trick. I'll go with this monkey patch for now...

import deepstreamClient from 'deepstream.io-client-js'

const createClient = () => deepstreamClient('localhost:6020')

window.ds = createClient()

ds.logout = () => {
  ds.close()
  window.ds = createClient()
}
demux
  • 4,544
  • 2
  • 32
  • 56
1

Calling ds.login again is meant to override the auth parameters with what is passed in. Created an issue to test this out and see we can replicate it / see if there is a bug somewhere.

Line it overrides at can be seen here

Issue raised here

yasserf
  • 391
  • 1
  • 7