> For the complete documentation index, see [llms.txt](https://docs.tryterra.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tryterra.co/faq/help-topics/connecting/apple-health-health-connect-and-mobile-sdk/sdk-provider-needs-deeplink-initconnection.md).

# Why is user\_id None for Apple Health in the widget?

SDK-based providers (Apple Health, Samsung Health, Health Connect) **cannot complete a connection through the web widget alone**, which is why the widget returns a null `user_id` for them. The user is only created on-device when `initConnection` runs. Apple Health has no web API and cannot be connected from a pure web app.

The unified pattern:

{% stepper %}
{% step %}
Set `auth_success_redirect_url` to a deep link or universal link into your app.
{% endstep %}

{% step %}
When the redirect's `resource` indicates an SDK provider, **call `initConnection`** (iOS / Flutter / React Native SDK) to prompt HealthKit permissions and finish the link.
{% endstep %}

{% step %}
API providers connect fully in the [widget](https://docs.tryterra.co/health-and-fitness-api/user-authentication/implementation-terra-widget).
{% endstep %}
{% endstepper %}

Data then flows to your webhooks and API as usual.

These providers appear in the widget because they are enabled in your dashboard. There is no self-serve setting to hide them, so to avoid showing them, split users into separate web vs mobile connection paths and present only platform-appropriate providers. See [customising authentication redirects](https://docs.tryterra.co/health-and-fitness-api/user-authentication/customising-authentication-redirects) for the redirect setup.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tryterra.co/faq/help-topics/connecting/apple-health-health-connect-and-mobile-sdk/sdk-provider-needs-deeplink-initconnection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
