You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have come across a situation where it is necessary to change the username used to authenticate the client. I am implementing a system where a user logs in using either (1) username and password (2) webtoken obtained from authentication done by the client itself. Since the username user and the webtoken user are one and the same, I require to change the client username to userId which is the same regardless of how the client authenticates.
I have so far managed to do it this way:
Changing the auth interface Authenticate(user, password []byte) (interface{}, error)
Obtaining new username and assigning to client during authentication
This issue has been resolved in v2.0.0 through the implementation of universal hooks. You should be able to set the client.ID value in OnConnect or OnConnectAuthenticate as client is a pointer. Let me know if it doesn't behave as expected.
I have come across a situation where it is necessary to change the username used to authenticate the client. I am implementing a system where a user logs in using either (1) username and password (2) webtoken obtained from authentication done by the client itself. Since the
username
user and thewebtoken
user are one and the same, I require to change the client username to userId which is the same regardless of how the client authenticates.I have so far managed to do it this way:
Changing the auth interface
Authenticate(user, password []byte) (interface{}, error)
Obtaining new username and assigning to client during authentication
Is this a feature you could consider?
The text was updated successfully, but these errors were encountered: