Accounts represent your users' accounts in third-party services. They hold credentials, such as access tokens, that Fiber uses to interact with the source API on your behalf. You can manage accounts via the Fiber dashboard or programatically via the API.
The credential format of each account will depend on the authorization
mechanisms of the source API. For example, adding a Shopify account will require
a myShopifyDomain
and an accessToken
value. (You can obtain those by taking
your users through the Shopify OAuth
flow.) Similarly, you
can add a Xero account to Fiber by providing a refreshToken
(because Xero
tokens expire after a while) as well as a tenantId
to identify the
organization you want to pull data from.
{
"myShopifyDomain": "example.myshopify.com",
"accessToken": "9814h2pkqfdga09ugfb13r90g13brgbi1"
}
Some sources in Fiber support more than one credential type, to account for the different ways to authenticate with the source API. For example, you can add Stripe accounts to Fiber using either a secret key (created manually by the end-user in their Stripe dashboard) or using the account ID of a Stripe account that instaled your app.
Accounts have an identifier
attribute, which Fiber uses to populate the
account_id
column in the destination tables or documents.
By default, Fiber sources compute the identifier for you, based on the
third-party object that corresponds to each account. For example, each Shopify account
in Fiber maps to a Shop
object.
So the default identifier for Shopify accounts is Shop.id
. For Stripe
accounts, the default identifier is
Account.id
.
For Plaid accounts, the default identifier is
Item.id
. And so on.
You can specify a custom identifier
when creating an account, and Fiber will
use this custom value to populate the account_id
column instead.
identifier
value to point to a
user or team ID in your database. Identifiers are unique within the accounts of a given source type in an environment. In database terms, we have a unique constraint on:
(identifier, sourceType, envId)
and Fiber will prevent you from creating an account if it violates this constraint.
You may find this limiting if you have multiple accounts on Fiber tied to the
same third-party tenant. (This can happen if you let multiple users in the same
organization go through individual OAuth flows.) Use custom identifier
values
to get around this limitation.
Accounts can exist in two states: enabled or disabled. You can manually disable accounts to pause all data syncing from them. This is useful to deal with inactive users. Fiber can also automatically disable accouts when it detects that the underlying credentials have been revoked or permanently expired.
You can toggle an account state via the dashboard. See below for instructions.
Use the Fiber dashboard to manage the accounts in your environment. Accounts are listed under the Accounts tab:
Accounts tab in the Fiber dashboard.
There you can see the account's identifier, source and associated syncs. You can also create, edit, and delete accounts via the dashboard.
There are two ways to create accounts: via the dashboard or 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:
Account creation modal.
Fiber will then attempt to verify the credentials you provided. If they are invalid, you will see an error message and have the chance to try again.
You can delete accounts via the dashboard by navigating to an account's page and clicking "Delete Account" button. Likewise, you can toggle the account state by clicking the "Enable"/"Disable" button.