Skip to main content
Hi,

 

I am using an external 3rd party offline mobile application which uses salesforce credentials to sign in to the app.

 

currently, I am facing an issue with the authentication.

 

Since the offline app rely on the salesforce username and password, I had to save a copy of salesforce login credentials in the offline app database. 

 

The offline app will work independently by using the authentication stored in its database. It needs authentication only while connecting the mobile app over internet and syncing the data.

 

When the user changes his/her password, we have to manually create a security token for that user and share his/her password and security token to the offline application team and this team will update their database manually with latest password and security token and release a new build of the application to all the users. 

 

Is there a way wherein as soon as the user changes his/her password, the password and security token will automatically sync to the mobile app database or is there any other way we can connect the offline app and salesforce.
1 个回答
  1. 2017年11月30日 13:08
    First and foremost, it is far from best practices to store salesforce usernames and passwords outside of SF in another database. Your applicagion really should use OAuth to authenticate rather than un/pw. OAuth tokens don't become invalid when the users changes their password.

     

    Regarding your question...

     

    There is NO automated way to retrieve a security token. It is a user-driven action in which the token is emailed directly to the user. Requesting the token must be initiated by the user manually or when an admin sets up a new user.

     

    Same holds true for passwords. You can't programtically manipulate or retrieve passwords. The user must set the password through a manual process in SFDC.

     

    I'd highly recommend you look at using OAuth

     

    https://help.salesforce.com/articleView?id=remoteaccess_authenticate_overview.htm