|
|
|
# Scenario Expired Access Token:
|
|
|
|
|
|
|
|
1. Make sure to have a valid developer admin account access in hubstaff to have access to all organization members. (User account type only allow's own data to be received).
|
|
|
|
2. Create an access token by going to the hubstaff linked apps using this link: https://account.hubstaff.com/account/linked_apps.
|
|
|
|
> Note: In case their process have changed, use this link on how to refresh the token. https://developer.hubstaff.com/
|
|
|
|
|
|
|
|
3. In the **hubstaff.php** controller. Change the `$_CLIENT_ID` and `$_CLIENT_SECRET` according to the provided credentials by the hubstaff API
|
|
|
|
|
|
|
|
``` php
|
|
|
|
|
|
|
|
|
|
|
|
class Hubstaff extends CI_Controller {
|
|
|
|
// ! ============== DO NOT DELETE THIS STATIC VARIABLES (only replace them if app "Hubstaff API" fails). ==============
|
|
|
|
static private $_CLIENT_ID = "";
|
|
|
|
static private $_CLIENT_SECRET = "";
|
|
|
|
static private $_CODE = "";
|
|
|
|
/**
|
|
|
|
* ... more code here
|
|
|
|
* ... that should not be replaced as it already uses AMTI credentials
|
|
|
|
*/
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
4. Once the `$_CLIENT_ID` and `$_CLIENT_SECRET` has been provided run the following function. **`refreshAccessToken()`**
|
|
|
|
> You can access this via the `https://<AMTI domain>/hubstaff/refreshAccessToken`.
|
|
|
|
|
|
|
|
5. This will echo the new access tokens if successful. else error will be displayed.
|
|
|
|
> You don't have to do anything if the access token is successfull as it is already cached by the system.
|
|
|
|
|
|
|
|
|