Logout API

The UserService Logout API seems not to clear out the userToken. So it’s like am still logged in after using the API

Backendless.UserService.logout(new AsyncCallback() {
public void handleResponse(Void response) {

                    Log.d(getClass().getName(),"UserToken After Logout:"+userToken.toString());


                public void handleFault(BackendlessFault fault) {


Hello @Nkekere_Tommy_Minimann

We will investigate your problem and respond as soon as possible.


Am still waiting for this update

Hi @Nkekere_Tommy_Minimann ,

could you please provide us your app ID?

Also, have you enabled by some chance Cookie Authorization in Console?


I don’t know about cookie authorization

No. Cookie authorization is not enabled

Hello @Nkekere_Tommy_Minimann

Where do you assign a value to the userToken variable?
Are you assigning a value to a userToken variable before or after a logout?

//This is my login code

Backendless.UserService.login(email, password, new AsyncCallback() {
public void handleResponse(BackendlessUser user) {
// user has been logged in
String userToken = UserTokenStorageFactory.instance().getStorage().get();
Log.d(getClass().getName(),“UserToken After Login:”+userToken.toString());


            public void handleFault(BackendlessFault fault) {
                // login failed, to get the error code call fault.getCode()

When I execute the logout code, the userToken isn’t cleared, so in effect the user is still logged in. But once I restart the app (after executing the logout code) the userToken gets cleared

I’ll try your code.

Have you tried to call the method
after logout ?

I’ve checked on Android and on plain Java.
Everything works as expected. After login the storage contains user-token and after logout it clear the record.
By the way you shouldn’t call Backendless.UserService.isValidLogin() in the handler.

Try to do this on clear Android App from scratch.

p.s. what version of sdk do you use?

Am using version 6.0.1 of the sdk, and I don’t understand what you mean by “you shouldn’t call Backendless.UserService.isValidLogin() in the handler”

  1. it is the old version, try the new one from the maven repository.
  2. about isValidLogin – i’m talking about AsyncCallback handlers. In Android you’re not allowed make network calls from the main thread.