Loading…

Mobile Integration Test Page test

Test all mobile app callbacks and web app actions

Web App Callbacks (Mobile App → Web)

Mobile app can call these functions to pass data to web app

1. Receive Access Token

Mobile app calls: window.receiveAccessToken("Bearer $token")

Note: "Bearer " prefix is automatically removed

2. Receive Token Update

Mobile app calls: window.receiveTokenUpdate("Bearer $newToken")

Note: "Bearer " prefix is automatically removed

Mobile App Callbacks (Web → Mobile App)

Web app can call these functions to notify mobile app

3. Request Token

Web calls: window.mobileNotify("REQUEST_TOKEN", null)

4. Back Button

Web calls: window.mobileNotify("BACK", null)

5. Logout

Web calls: window.mobileNotify("LOGOUT", null)

6. Token Invalid

Web calls: window.mobileNotify("INVALID_TOKEN", null)

7. Session Expired

Web calls: window.mobileNotify("SESSION_EXPIRED", null)

8. Token Updated

Web calls: window.mobileNotify("TOKEN_UPDATED", newToken)

9. Page Ready

Web calls: window.mobileNotify("PAGE_READY", null)

10. Token Received

Web calls: window.mobileNotify("TOKEN_RECEIVED", data)

11. Token Failed

Web calls: window.mobileNotify("TOKEN_FAILED", {reason})

Status Information

window.receiveAccessToken:Not Available
window.receiveTokenUpdate:Not Available
window.mobileNotify:Not Available

Activity Logs

No logs yet. Perform actions to see logs.

Instructions for Mobile App

1. To pass token to web app:

_controller.runJavaScript( 'window.receiveAccessToken("Bearer $token");', )

Note: Web app automatically removes "Bearer " prefix

2. To update token:

_controller.runJavaScript( 'window.receiveTokenUpdate("Bearer $newToken");', )

Note: Web app automatically removes "Bearer " prefix

3. Handle web app notifications (Flutter side):

JavascriptChannel( name: "MobileApp", onMessageReceived: (message) { final data = jsonDecode(message.message); switch (data['action']) { case "REQUEST_TOKEN": controller.runJavascript('window.receiveAccessToken("$token");'); break; case "INVALID_TOKEN": refreshTokenOrLogout(); break; case "LOGOUT": logoutUser(); break; case "BACK": Navigator.pop(context); break; case "TOKEN_UPDATED": saveNewToken(data['data']); break; } } )