Accounts hold credentials to load your users’ data from third-party apps. These credentials vary depending on the source type, but often include access tokens or account IDs.
Accounts are always associated with a particular Source in your environment. This gives you more control over which accounts are synced with which destinations. Also, third-party credentials are often tied to a particular developer identity (eg. a client ID and secret), which you provide as part of the source configuration.
There are two ways to create accounts in Fiber: on the dashboard, or using the API. The API method is most common — you will likely want to create accounts programmatically as users sign up for your app.
Follow these steps to create an account via the dashboard:
- Go to the Sources tab on the dashboard.
- Click on the source you want to add an account for.
- Go to the Accounts tab.
- Click the Add account button.
- Enter the account’s credentials. These fields will vary depending on the source type.
- Click Save.
Fiber does its best to verify that the credentials you provide are valid, but that isn’t always possible. When credentials are invalid, Fiber may refuse to create the account. This is true in both dashboard and API methods.
Use the Fiber dashboard to manage the accounts in your environment. Accounts are listed under the Accounts tab of each source page.
There you can see the account’s external ID, metadata, and state. You can also create, edit, and delete accounts.
Accounts within a source are uniquely identified by an external ID, a value set by Fiber with meaning that varies from source to source.
For Shopify accounts, Fiber sets the
external_id to the Shopify store’s Shop
GitHub accounts, the
external_id is the
of the GitHub app. This value is provided by the developer as part of the Github
account credential, but verified to correspond to an actual installation ID by
Fiber by querying the GitHub API.
The Fiber API returns the external ID when you register a new account, and uses it to identify accounts for other API endpoints. You should store this ID in your database, associated with the user or team who owns the third-party account.
The uniqueness of external IDs helps prevent nasty API rate limit issues. For that reason, Fiber tries to obtain the external ID from the third-party API by querying it with the credentials you provide. However, this isn’t always possible.
For a small number of sources, such as Amazon Selling Partner, Fiber may not be able to read a unique account identifier from the third-party API. In those cases, Fiber may automatically assign a particular field from the credential object as the external ID, without being able to verify that it is unique. Those sources may contain duplicate accounts pulling the same data without warning, so be careful.
At any time, an account can be either active or disabled. By default, syncs will pull data from all active accounts tied to that portal’s source. Disabled accounts will stop being pulled from.
Accounts can be disabled by Fiber or by you.
Over time, Fiber may disable accounts that it can no longer pull data from. Credentials may expire or be revoked (eg. if a user uninstalls your app) in ways that Fiber can’t automatically correct. When that happens, Fiber may deactivate the particular account.
Toggling an account state
You can toggle account states via the dashboard or the API.
A small number of sources call for extra coordination when it comes to refreshing third-party credentials. This is sometimes the case with OAuth APIs that implement refresh tokens, such as Quickbooks. These APIs only allow a single access token to be active for a given set of credentials at a time. This becomes a problem when both Fiber and your backend expect to be able to obtain a new access token for a particular credential.
To prevent this, Fiber takes “custody” of the refresh token for accounts where it is necessary, and offers an API for you to query for fresh access tokens when you need them. Whenever you want, you can free the refresh token and regain custody of the account. When that happens, Fiber will disable the account and stop pulling data from it.