Skip to main content

Customization

You may want to have your own custom Link widget to match your app's UI. This is useful for users who don't want to use Vital link but still want to use the Vital API. To authenticate without Vital link, you need to first generate a link_token for a specific user.

Generating a Vital-Link
1
2
3
4
5
6
7
8
9
from vital import Client

client = Client(
  api_key=<API_KEY>,
  environment="sandbox",
  region="us"
)

token = client.Link.create(user_id)


Once you have your Vital link token, you can use this to connect to a specific provider. Providers are split by their authentication flows: EMAIL, OAUTH, PASSWORD.

Email​

Current email providers are:

ProviderDescription
FreestyleAbbott CGM Glucose monitor

Email + Password​

Current email and password providers are:

ProviderDescription
RenphoFitness Scales
ZwiftVirtual cycling and running
PelotonPopular Indoor Exercise bike
Eight SleepSmart Mattress
BeurerBlood pressure and glucose devices
WhoopSmart Activity Watches

To connect a password provider:

Connecting a password provider:
1
2
3
4
5
6
7
8
9
10
from vital import Client

client = Client(
  api_key=<API_KEY>,
  environment="sandbox",
  region="us"
)

token = client.Link.create(user_id)
resp = client.Link.password_provider(link_token, "oura", username, password)


OAuth​

Current OAuth providers are:

ProviderDescription
FitbitActivity Trackers (all devices)
GarminFitness watches (all devices)
OuraSmart Sleep tracking ring
StravaRunning & Cycling Social Network
WahooCycling Equipment
iHealthBlood pressure, Fitness scales, Glucometers & Fitness watches
WithingsFitness scales, watches and health monitors


Connecting a password provider:
1
2
3
4
5
6
7
8
9
10
11
from vital import Client

client = Client(
  api_key=<API_KEY>,
  environment="sandbox",
  region="us"
)

token = client.Link.create(user_id)
oauth_url = client.Link.oauth_provider(link_token, "fitbit")
# redirect user to returned oauth_url

For OAuth Providers we return an oauth_url that can be used to redirect users to. In a web view, on redirection, you should check the user has connected to the provider successfully. In the case of mobile, the user should receive a message to return to the app.

The possible error codes that are returned are as follows: 401 INVALID_REQUEST Link Token is Invalid 400 MISSING_LINK_TOKEN Missing link token 400 INVALID_PROVIDER Provider is not supported 400 INVALID_USER_ID User id is incorrect 400 INVALID_CREDENTIALS Credentials for provider are incorrect