@ave-id/embed
The Ave embed library provides a lightweight, iframe-based solution for integrating Ave authentication into your web application. It uses postMessage callbacks for secure communication between your app and the Ave authentication flow.Installation
Embedding Options
The library supports multiple embedding strategies to fit different use cases:Inline iframe
Embed the authentication flow directly into your page usingmountAveEmbed(). Best for:
- Dedicated sign-in pages
- Seamless user experience
- Full control over positioning
Modal sheet
Display authentication in a mobile-friendly bottom sheet usingopenAveSheet(). Best for:
- Mobile-first applications
- Native app-like experience
- Overlay authentication flows
Popup window
Open authentication in a separate popup window usingopenAvePopup(). Best for:
- Desktop applications
- Multi-window workflows
- Traditional OAuth flows
Common Configuration
All embedding methods share common configuration options:| Option | Type | Required | Default | Description |
|---|---|---|---|---|
clientId | string | Yes | - | Your Ave client ID |
redirectUri | string | Yes | - | OAuth redirect URI |
scope | string | No | "openid profile email" | OAuth scopes |
issuer | string | No | "https://aveid.net" | Ave issuer URL |
onSuccess | function | No | - | Success callback with redirect URL |
onError | function | No | - | Error callback with error details |
onClose | function | No | - | Close callback (sheet/popup only) |
Callbacks
onSuccess
Called when authentication completes successfully:onError
Called when an error occurs during authentication:onClose
Called when the user closes the sheet or popup (not available for inline iframes):All callbacks use postMessage for secure cross-origin communication between your app and the Ave authentication iframe.
Advanced Flows
For advanced use cases, the library also supports:- Connector flows - Separate resource authorization flows using
openAveConnectorSheet() - Runtime execution - Protected browser execution with
openAveConnectorRuntime()
Browser Compatibility
Next Steps
Choose an embedding method that fits your use case:Inline iframe
Embed authentication directly in your page
Modal sheet
Mobile-friendly bottom sheet overlay
Popup window
Traditional popup window flow
Connector flow
Advanced resource authorization