Exchange app credentials or admin auth for user-scoped access token.
Supports two authentication methods:
Both methods return access_token with refresh_token.
Returns a JWT token scoped to SDK endpoints only. Tokens expire after configured time (default: 60 minutes).
Args: user_id: OpenWearables User ID (UUID) payload: Optional application credentials (app_id, app_secret) db: Database session developer: Optional authenticated developer (from Bearer token)
Returns: TokenResponse containing access_token, token_type, and refresh_token
Raises: 401: If app credentials are invalid or admin auth is missing 400: If neither app credentials nor admin auth is provided
The access token received from the authorization server in the OAuth 2.0 flow.