> ## Documentation Index
> Fetch the complete documentation index at: https://docs.junction.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Provider Types

> Browse all supported wearable providers grouped by authentication type: OAuth, email, and email plus password connections.

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:

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { JunctionClient, JunctionEnvironment } from "@junction-api/sdk";

  const client = new JunctionClient({
      apiKey: "YOUR_API_KEY",
      environment: JunctionEnvironment.Sandbox,
  });

  const tokenResponse = await client.link.token({ userId: "<user_id>" });

  const auth = await client.link.generateOauthLink({
      oauthProvider: "oura",
      vitalLinkToken: tokenResponse.linkToken,
  });
  ```

  ```python Python theme={null}
  from junction import Junction, OAuthProviders
  from junction.environment import JunctionEnvironment

  client = Junction(
      api_key="YOUR_API_KEY",
      environment=JunctionEnvironment.SANDBOX,
  )

  token_response = client.link.token(user_id="<user_id>")

  oauth = client.link.generate_oauth_link(
      OAuthProviders.OURA,
      vital_link_token=token_response.link_token,
  )
  ```

  ```java Java theme={null}
  import com.junction.api.Junction;
  import com.junction.api.core.Environment;
  import com.junction.api.resources.link.requests.GenerateOauthLinkLinkRequest;
  import com.junction.api.resources.link.requests.LinkTokenExchange;
  import com.junction.api.types.OAuthProviders;

  Junction client = Junction.builder()
      .apiKey("YOUR_API_KEY")
      .environment(Environment.SANDBOX)
      .build();

  var tokenResponse = client.link().token(
      LinkTokenExchange.builder()
          .userId("<user_id>")
          .build()
  );

  var oauth = client.link().generateOauthLink(
      OAuthProviders.OURA,
      GenerateOauthLinkLinkRequest.builder()
          .vitalLinkToken(tokenResponse.getLinkToken())
          .build()
  );
  ```

  ```go Go theme={null}
  import (
      "context"

      junction "github.com/junction-api/junction-go"
      "github.com/junction-api/junction-go/client"
      "github.com/junction-api/junction-go/option"
  )

  c := client.NewClient(
      option.WithApiKey("YOUR_API_KEY"),
      option.WithBaseURL(junction.Environments.Sandbox),
  )

  tokenResponse, err := c.Link.Token(context.TODO(), &junction.LinkTokenExchange{
      UserId: "<user_id>",
  })
  if err != nil {
      return err
  }

  oauth, err := c.Link.GenerateOauthLink(context.TODO(), &junction.GenerateOauthLinkLinkRequest{
      OauthProvider:  junction.OAuthProvidersOura,
      VitalLinkToken: &tokenResponse.LinkToken,
  })
  if err != nil {
      return err
  }
  fmt.Printf("Received data %s\n", oauth)
  ```
</CodeGroup>

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:

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { JunctionClient, JunctionEnvironment } from "@junction-api/sdk";

  const client = new JunctionClient({
      apiKey: "YOUR_API_KEY",
      environment: JunctionEnvironment.Sandbox,
  });

  const data = await client.link.connectPasswordProvider({
      provider: "whoop",
      username: "<username>",
      password: "<password>",
  });
  ```

  ```python Python theme={null}
  from junction import Junction, PasswordProviders
  from junction.environment import JunctionEnvironment

  client = Junction(
      api_key="YOUR_API_KEY",
      environment=JunctionEnvironment.SANDBOX,
  )

  data = client.link.connect_password_provider(
      PasswordProviders.WHOOP,
      username="<username>",
      password="<password>",
  )
  ```

  ```java Java theme={null}
  import com.junction.api.Junction;
  import com.junction.api.core.Environment;
  import com.junction.api.resources.link.requests.IndividualProviderData;
  import com.junction.api.types.PasswordProviders;

  Junction client = Junction.builder()
      .apiKey("YOUR_API_KEY")
      .environment(Environment.SANDBOX)
      .build();

  var data = client.link().connectPasswordProvider(
      PasswordProviders.WHOOP,
      IndividualProviderData.builder()
          .username("<username>")
          .password("<password>")
          .build()
  );
  ```

  ```go Go theme={null}
  import (
      "context"

      junction "github.com/junction-api/junction-go"
      "github.com/junction-api/junction-go/client"
      "github.com/junction-api/junction-go/option"
  )

  c := client.NewClient(
      option.WithApiKey("YOUR_API_KEY"),
      option.WithBaseURL(junction.Environments.Sandbox),
  )

  response, err := c.Link.ConnectPasswordProvider(context.TODO(), &junction.IndividualProviderData{
      Provider: junction.PasswordProvidersWhoop,
      Username: "<username>",
      Password: "<password>",
  })
  if err != nil {
      return err
  }
  fmt.Printf("Received data %s\n", response)
  ```
</CodeGroup>
