WebView
Embed the Enable3 widget directly inside your mobile app
For security reasons, your mobile app shouldn't connect to Enable3 on its own. Instead, your backend (server) should request a widget link on behalf of the current user and pass that link to the mobile app to load. This keeps your credentials safe and off the device.
Integration flow
The user opens the Loyalty screen in your mobile app.
The mobile app requests a widget URL from your backend.
Your backend calls the Enable3 integration API.
Enable3 returns a widget URL with an embedded authentication token.
The mobile app opens this URL inside a WebView.
If the WebView receives a
401 Unauthorizedresponse, request a new widget URL and reload the WebView.
Get widget URL
Your backend should call:
GET https://integration.enable3.io/api/v1/integration/user/{operatorUserId}/widgetHeaders
X-API-KEY: <operator-api-key>Optional query parameters
Parameter
Type
Description
referralCode
string
Optional referral code provided by the operator on behalf of the user.
Example request
Example response
Important notes
Never expose your
X-API-KEYinside a mobile application.The mobile app should receive only the generated widget URL.
The widget URL already contains the required authentication token.
The widget URL is temporary and should be refreshed when expired.
If the WebView returns
401 Unauthorized, request a new widget URL from your backend and reload the WebView.JavaScript must be enabled in the WebView.
Load only trusted HTTPS URLs returned by Enable3.
React Native
Use react-native-webview to open the Enable3 widget URL.
Install dependency
or
Example
Android
Use the native Android WebView to open the Enable3 widget URL.
AndroidManifest.xml
Make sure the app has internet access:
Layout example
Java example
Flutter
Use the official webview_flutter package.
Install dependency
Add the package to pubspec.yaml:
Example
iOS: Swift
Use WKWebView to open the Enable3 widget URL.
Example
iOS: Objective-C
Use WKWebView to open the Enable3 widget URL.
Header
Implementation
Expired widget URL handling
The widget URL contains a temporary authentication token. If the token expires, the WebView may return 401 Unauthorized.
Recommended handling:
Detect
401 Unauthorizedin the WebView.Call your backend to request a fresh Enable3 widget URL.
Reload the WebView with the new URL.
Avoid infinite reload loops. If refreshing fails, show an error state with a retry button.
Security recommendations
Do not store the Enable3 API key in the mobile app.
Do not call the Enable3 integration API directly from the mobile app.
Always request the widget URL through your backend.
Use HTTPS only.
Enable JavaScript only for trusted Enable3 widget URLs.
Do not inject custom JavaScript unless it is required and reviewed.
Do not allow the WebView to freely navigate to untrusted external domains.
Last updated