function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jayakrishnan SalimJayakrishnan Salim 

INVALID_SESSION_ID While Switching Users

Hi, 
I am using SalesforceSDK for Android in one of my apps. The issue I am facing is, I am not able to re-login as a different user after logging out. 
The code I am using for logout the current user is 
SalesforceSDKManager.getInstance().logout(this);
After that the login screen comes. But while I try to login as a different user, it throws the below error and goes back to login screen again. 
{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}
If I re-login as same user, I am not getting this error. 
To successfully re-login as a new user, I have to kill the app from background and then relaunch it. 

Kindly help me on this. 
Thank you in advance. 

 
NagendraNagendra (Salesforce Developers) 
Hi JayaKrishnan,

May I request you please confirm if you are using a single instance or multiple instances of SalesforceSDKManager?

If you are using single instance may I suggest you 
create a new one after performing the logout.

Thanks,
Nagendra 
 
Jayakrishnan SalimJayakrishnan Salim

Hi Nagendra, 

Thank you for the response. I couldn't find an option to create another instance of SalesforceSDKManager. It's been managed by the SDK itself. If you have any code snippet to share, that would have been very helpful.