validation is the only supported widget type - it displays a policy’s validation result to the user.
Start a widget session
Once you have avalidationResult from Validate Policy, start a widget session using the Start Widget endpoint. This returns a widgetToken and a widgetUri to display to the user.
Request Sample
Response
Appending origin or redirect URI
Before rendering the widget, your application should append eitherorigin (for web) or redirectUri (for mobile) as a query parameter to the widgetUri. This tells the widget how to communicate back to your application on exit.
Web:
Web: Display in iframe
1
Open iframe
Render the
widgetUri (with origin appended) in an iframe set to 100% width and 100% height of the viewport. Axle handles all internal layout and scrolling, so your application doesn’t need to manage the widget’s sizing.2
Listen for MessageEvent
Add an event listener on the parent window. For security, verify that the message origin is the Axle widget domain (e.g.,
https://widget.sandbox.axle.insure) before processing.3
Process the exit event
When the user closes or exits the widget, remove the iframe (or close the modal) and return the user to the previous view.
Page with iframe and eventListener (example)
Mobile: Display in native webview
Open thewidgetUri (with redirectUri appended) in a native webview. When the user exits the widget, Axle redirects to the redirectUri you provided with a status query parameter appended:
Widget events
onExit
Emitted when the user closes or exits the widget (e.g., clicks a close button or back action). ViapostMessage (web):
That’s it - your users can now view their validation result through Axle’s widget without leaving your application 🎉.