The Field Nation REST API uses OAuth 2.0 to authenticate connections.
- You must include a valid access token with every request:
- Access tokens expire in 3600 seconds (one hour).
- Separate codes are required for the Sandbox and Production environments.
- Refresh tokens are not supported.
When you Request Access to the Sandbox and/or Production environments, Field Nation will assign you a unique client_id and client_secret. You can use these values along with your Field Nation login credentials to call the Request OAuth Token endpoint. This endpoint will return a valid access_token for your current session.
To limit API calls and improve your application's performance, it's recommended that you incorporate some session tracking logic. Several options include:
- Calculating the expires_in seconds to a future UTC date and time (expires time), then comparing the current time to the expires time.
- Using the error message to identify an expired session. Refer to Invalid Token Error below for more information.
Invalid Token Error
400 Bad Request: Expired token.
You must provide a valid OAuth token to make a request