Documentation Index
Fetch the complete documentation index at: https://vital-mintlify-seo-audit-1777989329.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Providers have different authentication flows. Some require a username and password, others require an email address and password. Junction supports the following provider types:
OAuth
Email
Email + Password
The majority of providers are OAuth providers. These providers require a user to be redirected to a third-party website to authenticate. Once authenticated, the user is redirected back to the link widget.
The Email and Email + Password providers require a user to enter their email address and password into the link widget. These are then sent to Junction and used to connect to the provider.
The list of providers and their auth types is as follows:
OAuth
Current OAuth providers are:
| Provider | Description |
|---|
Fitbit | Activity Trackers (all devices) |
Garmin | Fitness watches (all devices) |
Oura | Smart Sleep tracking ring |
Strava | Running & Cycling Social Network |
Wahoo | Cycling Equipment |
Withings | Fitness scales, watches and health monitors |
Google Fit | Activity Trackers (all devices) |
Polar | Finnish sports tech pioneer |
Cronometer | Nutrition data |
Omron | Blood Pressure data |
WHOOP | Smart Activity Watches |
Dexcom | Glucose monitors |
To connect an OAuth provider:
import { VitalClient, VitalEnvironment } from '@tryvital/vital-node';
import { LinkTokenExchange, LinkGenerateOauthLinkRequest, OAuthProviders } from '@tryvital/vital-node/api';
const client = new VitalClient({
apiKey: '<my_api_key>',
environment: VitalEnvironment.Sandbox,
});
const request: LinkTokenExchange = {
userId: "<user_id>",
}
const tokenResponse = await client.link.token(request)
const linkRequest: LinkGenerateOauthLinkRequest = {
vitalLinkToken: tokenResponse.linkToken,
}
const auth = await client.link.generateOauthLink(
OAuthProviders.<provider>,
linkRequest
)
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
Email
Current email providers are:
| Provider | Description |
|---|
Freestyle | Abbott CGM Glucose monitor |
Email + Password
Current email and password providers are:
| Provider | Description |
|---|
Zwift | Virtual cycling and running |
Peloton | Popular Indoor Exercise bike |
Eight Sleep | Smart Mattress |
Beurer | Blood pressure and glucose devices |
Hammerhead | Cycling Computer |
Dexcom G6 & Older | CGM Glucose Monitor |
MyFitnessPal | Meal Tracking Application |
Kardia | EKG Application |
To connect an email and password provider:
import { VitalClient, VitalEnvironment } from '@tryvital/vital-node';
import { IndividualProviderData, PasswordProviders } from '@tryvital/vital-node/api';
const request: IndividualProviderData = {
username: '<username>',
password: '<password>',
}
const data = await client.link.connectPasswordProvider(PasswordProviders.<provider>, request)