LiveComponent that encapsulates the OAuth connect flow.
Handles session creation, authorization URL generation, and popup-based OAuth completion via JS hooks and postMessage.
Usage
<.live_component
module={Tango.Live.OAuthComponent}
id="github-oauth"
provider="github"
tenant_id="user-123"
callback_url="http://localhost:4000/api/oauth/callback"
on_connect="oauth_connected"
on_error="oauth_error"
/>Required Assigns
provider— provider slug string (e.g."github")tenant_id— tenant identifier stringcallback_url— the URL where Tango's API Router handles callbacks
Optional Assigns
scopes— list of scope strings (defaults to provider's default scopes)button_class— CSS classes for the connect buttonbutton_label— override button text (default: "Connect {Provider}")on_connect— event name sent to parent on success (default:"oauth_connected")on_error— event name sent to parent on failure (default:"oauth_error")
Events Sent to Parent
On success, sends {on_connect, %{provider: ..., token: ..., scopes: ..., ...}} via send/2.
On error, sends {on_error, %{error: reason}} via send/2.