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
SebastianBraunSebastianBraun 

Using Rest API with grant_type password

Hi Everyone,

 

i have a little control device with android on it, which communicates with the Salesforce Rest API. Because i have no User-Interaction here i'm using grant_type password to authenticate my devices to salesforce. My problem now is, how to handle the session timeouts. In contrast to grant_type refresh-token i do not get a refresh-token.

 

https://help.salesforce.com/help/doc/en/remoteaccess_oauth_username_password_flow.htm

 

Therefore i'm not sure whats the best-practice to handle the timeout. Right now, i'm checking the respone and if its not 201 (created) and the message says invalid sessionid, i just login again. 

 

Thanks in advance

 

Sebastian