Is there a simpler way of accessing my companies data through the REST API, and have the web server that fetches that data be indefinitely authenticated?
I tried using the web server flow with a refresh token but after a while when the sessions expires, the webserver fails to fetch data as its being redirected to the salesforce login page.
The current setup using the login + password flow works as it has the credentials to login, however i am looking for a safer option without exposing our credentials.
My company uses Salesforce to store customer accounts, and orders, which are later displayed on our Wordpress website. When the user logs in on Wordpress their email is used as a key to query Salesforce for their orders. Steps are:
- User logs in on wordpress at
www.company.com
www.company.com
queriesapi.company.com
with the users email and checks if they have made any orders.- If the token is valid get data, if expired refresh it with a refresh token.
The problem mentioned is when the session expires and api.company.com is asked to log back into salesforce.