User already logged in, but currentUser is null

I have a situation where I’m trying to login a user, but I get an error “3002” “The user is already logged in.” I’m not even sure this should be an error, but that’s a different topic. The main problem is that at the same time, Backendless.UserServer.currentUser resolves null.

Which SDK do you use?

Flex/Air SDK. I just tried running the UserService.logout() to clear up any issues, but that throws an error:
“Couldn’t establish a connection to ‘GenericDestination’”

[MessagingError message=‘Destination ‘GenericDestination’ either does not exist or the destination has no channels defined (and the application does not define any default channels.)’]

Is it a Flex app or an Air app?
Is it an ActionScript-only project?
Running on a desktop, in a browser or a mobile device?

What version of the Flex/Air SDK do you use?

Thanks,
Mark

It’s a Flex AND AIR app, running on the desktop.

Apache Flex SDK 4.13.0.20140701
AIR SDK 15.0.0.356

Not sure the exact version of the Backendless SDK, but it was downloaded from GitHub on 12/21

Thanks, we’re looking into it.

Regards,

Mark

Devin,

I cannot reproduce neither one of the reported problems (“error 3002” and “GenericDestination”). Would it be possible for you to create a small project which runs just the login call for your app and email it to me? My email is mark@backendless.com.

Thanks!
Mark

will do, give me a bit to strip out all the unneccessary stuff

Hi Devin!

In your app there is such configuration: Users -> Login -> Enable Multiple Logins -> When a secondary login occurs, logout and notify: Second user.

For second login of the same user, server returns error “3002” “The user is already logged in.” Because first session not expired.
If you select:
Users -> Login -> Enable Multiple Logins -> When a secondary login occurs, logout and notify: First user
it will fix the problem.

Regards,
Kate.

Kate, I think I understand now.

Having “Notify Second User” selected means that the 2nd user is not able to login until the first user’s session expires. That’s why the UserService.currentUser returns null because that 2nd user was never logged in. And that’s also why the UserService.logout() doesn’t work that 2nd user was never logged in.

The confusing part about this is just the error message then. When the 2nd user tries to login and it errors with the message “The user is already logged in”, I had no idea that was referring to previous session. Hence, my assumption that currentUser/logout() should then also work.

If the error message said something like “The user is already logged in for another session.”, it would’ve made more sense.

Thanks for clearing all that up for me!

Yes, you are right.
We will change error message to make it more informative.

Regards,
Kate.