client_id and client_secret. Subsequently, this API call should be invoked from your server, to protect your API credentials from being exposed on the client-side.
The response will contain an OAuth 2.0 access_token, which should be added to your request headers (per the OAuth 2.0 protocol) for all subsequent API requests on behalf of this user.
1. Registering a user
The Tight API’s endpoint for registering a user contains a variety of input parameters for more personalized functionality:
The response from POST /account contains the user’s
access_token, which you should store in your database, and associate to your user. This access_token can be used to access the entirety of the Tight API and the Tight Embedded UI on behalf of your user.
2. Refreshing the user’s access_token
Per OAuth 2.0 spec, the above response from POST /account also contains arefresh_token and expires_in field. You can calculate the expiration date/time of the access_token by summing the created_at and expires_in fields, which will yield a specific date/time in UNIX Epoch time.
Per OAuth 2.0 spec, when an access_token expires, you can refresh the token using the /token endpoint .
3. Removing a user
If your user deletes their account within your app, then you will want to remove their account from the Tight API. Once the above DELETE call is made, the user’s data will be inaccessible. After 30 days, it will be permanently deleted. During the 30 day period, you may restore that user’s account if needed (e.g. if the user accidentally deleted their account). Since the user’s account was previously removed, Tight’s standard Authentication (with theaccess_token in the header) will not work; instead, the accessToken will need to be included in the POST data in the request to restore the user’s account.