change username when logged in

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

grhwood
Posts: 116
Joined: 15 Mar 2011, 04:43

change username when logged in

Postby grhwood » 01 Apr 2011, 03:42

Hi,

My app doesn't use username to authenticate user instead the user logged in webapp and i use flashvar to pass a token to flash, then i use this token to get user's info like username.

I used user.setName to change username but sfs still use that token to identify user connection, so when i close the brower's tab and reconnect, sfs doesn't let me in because of "Login error: Another user is already logged with the same name"

Thank you.
User avatar
Bax
Site Admin
Posts: 4482
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 01 Apr 2011, 08:16

You can't connect using a name, and then change it later.
Paolo Bax
The SmartFoxServer Team
User avatar
Lapo
Site Admin
Posts: 21128
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 01 Apr 2011, 08:33

You can change the name at login time.
See login tutorial:
http://docs2x.smartfoxserver.com/Gettin ... wtos#item3
Lapo
--
gotoAndPlay()
...addicted to flash games
grhwood
Posts: 116
Joined: 15 Mar 2011, 04:43

Postby grhwood » 01 Apr 2011, 18:02

Thanks lapo! This is exactly what i need.
grhwood
Posts: 116
Joined: 15 Mar 2011, 04:43

Postby grhwood » 04 Apr 2011, 03:17

Hi Lapo,

Can i use the LOGIN_OUT_DATA object to pass some more info to the client for example pass fullname to the client:

outData.putUtfString("fullName", ...);
grhwood
Posts: 116
Joined: 15 Mar 2011, 04:43

Postby grhwood » 04 Apr 2011, 04:55

grhwood wrote:Hi Lapo,

Can i use the LOGIN_OUT_DATA object to pass some more info to the client for example pass fullname to the client:

outData.putUtfString("fullName", ...);


It is possible :)
User avatar
marsoups
Posts: 164
Joined: 14 Apr 2008, 03:30

Re:

Postby marsoups » 16 Sep 2019, 06:49

Lapo wrote:You can change the name at login time.
See login tutorial:
http://docs2x.smartfoxserver.com/Gettin ... wtos#item3


My apologies, but this document seems to be missing or moved. I'm wondering how to go about changing the username from the java code at login time. Thanks!
User avatar
Lapo
Site Admin
Posts: 21128
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Re:

Postby Lapo » 16 Sep 2019, 07:03

marsoups wrote:
Lapo wrote:You can change the name at login time.
See login tutorial:
http://docs2x.smartfoxserver.com/Gettin ... wtos#item3


My apologies, but this document seems to be missing or moved. I'm wondering how to go about changing the username from the java code at login time. Thanks!

You can find it here:
https://smartfoxserver.com/blog/how-to- ... tom-login/
See point #4 in particular.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 15 guests