Endpoint
Overview
This endpoint is called by the health provider after the user grants permissions. It completes the OAuth flow by exchanging the authorization code for access tokens and saves the credentials.How It Works
When a user completes authorization on the provider’s website, the provider redirects back to this callback URL with authorization codes. Mirobody Health then:- Validates the OAuth state parameter
- Exchanges the authorization code for access tokens
- Saves encrypted credentials to the database
- Triggers an initial data sync
- Redirects the user (if
return_urlwas provided)
OAuth 2.0 Callback Parameters
Authorization code from the provider
State parameter for CSRF protection
OAuth 1.0 Callback Parameters
OAuth request token
OAuth verifier code
Callback Flow
Response
After processing, the callback typically redirects the user. If called directly or in error cases, it returns JSON:Troubleshooting
Invalid State Error
Invalid State Error
Cause: State parameter doesn’t match or has expiredSolutions:
- Ensure user completes authorization within 15 minutes
- Don’t modify the authorization URL
- Check that Redis is running and accessible
Token Exchange Failed
Token Exchange Failed
Cause: Provider rejected the code exchangeSolutions:
- Verify OAuth credentials are correct
- Check redirect URI matches provider configuration
- Ensure authorization code hasn’t expired (usually 10 minutes)
Redirect Loop
Redirect Loop
Cause: Callback URL misconfiguredSolutions:
- Verify callback URL in provider developer portal
- Check for typos in redirect URL configuration
- Ensure URL protocol matches (http vs https)
This endpoint is configured as the OAuth callback URL in each provider’s developer portal. The exact URL format is:Replace with your production domain in production environments.