Terra Docs
Dashboard
  • Docs
  • API Reference
  • Changelog
  • Getting Started
    • What is Terra API?
    • Account setup and API keys
    • Core concepts
  • Health & Fitness API
    • Overview
    • Quickstart
    • Integration setup
      • Understanding sources and destinations
      • Setting up data sources
      • Setting up data destinations
        • Webhooks
        • SQL database (Postgres, MySQL)
        • Supabase
        • Cloud storage (S3, GCP)
        • Queuing services (SQS, Kafka)
      • Customising data types
      • Dedicated data source API keys
      • Understanding Terra environments
    • User authentication
      • Authentication flow
      • Implementation (Terra widget)
      • Implementation (Custom UI)
      • Handling authentication events
      • Customising authentication redirects
    • Managing user health data
      • Receiving health data updates (events)
      • Requesting historical health data (REST API requests)
      • Writing data
    • Mobile-only sources
      • iOS (Swift)
      • Android (Kotlin)
      • React Native
      • Flutter
    • Troubleshooting
    • Pricing
  • User Engagement
    • Health Scores
  • Streaming API
    • Overview
    • Wearable -> Your app
      • iOS (Swift)
      • Android
    • Your app -> Terra
      • iOS (Swift)
      • Android
    • Terra -> Your backend
  • Teams API
  • Biomarkers API - Upcoming
Powered by GitBook
On this page
  • Overview
  • Authentication Flow Final URL
  • How to Customize the Redirect URLs?
  • Different ways to Customize the Auth Result URL

Was this helpful?

  1. Health & Fitness API
  2. User authentication

Customising authentication redirects

PreviousHandling authentication eventsNextManaging user health data

Last updated 24 days ago

Was this helpful?

Overview

After the end-user completes the authentication flow, they will be redirected to a default final url that's either a success or failure screen before they go back to your app.

These urls can be customized when you're calling one of the /auth endpoints.


Authentication Flow Final URL

When the user authenticates a health account (e.g. Oura), before they go back to your app, they see a final URL (screen) of the authentication flow is either a success or failure screen.

The final url will append the following parameters:

  • user_id (not Null)

  • resource (not Null)

  • reference_id (can be Null - if you did not pass it in the auth endpoint).

Success Auth URL (Example)
https://widget.tryterra.co/session/demo/success?user_id=bc205b50-dabe-4680-9d35-38517b915dc1&resource=GOOGLE&reference_id=null 

How to Customize the Redirect URLs?

Terra provides these urls by default, and they can also be customized in the /auth endpoints. They can be specified in the body of the authentication request as:

  • auth_success_redirect_url

  • auth_failure_redirect_url


Different ways to Customize the Auth Result URL

You can redirect to a:

  • Web Page: A specific page on your web application, including any useful query parameters.

    • Example: https://somereallycoolcompany.com?terra_auth_success=true

  • Deep Link: A deep link into your mobile application.

    • Example: reallycoolapp://success

Mobile-based integrations

  • This Redirect URL can be used to redirect your end-user to your mobile app instead so that they complete the connection flow to the Mobile-only integrations using Deep Links.

When using the widget, when the user selects one of the (e.g. Apple Health, Samsung Health, Health Connect), they will by default be redirected to the auth_success_redirect_url with a null user_id .

Mobile SDK-based integrations
Default Success Redirect URL
Default Failure Redirect URL