Overview
Web APIs added to OpenFin's Secure API designation as a part of v16. As with other Secure API calls, this assists Desktop Owners to recognize the upfront intent to use these APIs. These Web APIs include:
audio
video
geolocation
notifications
midiSysex
pointerLock
fullscreen
openExternal
Runtime Version: 16.83.50.9+
Add the API to your permissions
You can easily diagnose which API string to add to your permissions, follow these steps
- Add "--v=1" to the runtime arguments and then restart the application.
- Try to use the use the webAPI. This will fail silently in the background.
- Open the debug log from %localappdata%/OpenFin/cache/<runtime version>/debug.log
- look for the following lines in the log file, this example show that we are trying to use the "notifications" API but it is being rejected by the
- [2022-01-17 18:05:09.529]-[VERBOSE1:electron_api_app.cc(1840)] setPermissionRequestHandler notifications
- [2022-01-17 18:05:09.529]-[VERBOSE1:electron_api_app.cc(1840)] apiPolicyPreProcessor 'notifications' from platform_bare_bones_example main_component
- [2022-01-17 18:05:09.529]-[VERBOSE1:electron_api_app.cc(1840)] authorizeWebAPIFromPolicy 'notifications' for platform_bare_bones_example main_component
- [2022-01-17 18:05:09.530]-[VERBOSE1:electron_api_app.cc(1840)] authorizeActionFromPolicy checking with config url http://localhost:5555/app.json 'notifications' for platform_bare_bones_example main_component
- [2022-01-17 18:05:09.530]-[VERBOSE1:electron_api_app.cc(1840)] requestAppPermissions http://localhost:5555/app.json
- [2022-01-17 18:05:09.530]-[VERBOSE1:electron_api_app.cc(1840)] retrieveAPIPolicyContent
- [2022-01-17 18:05:09.530]-[VERBOSE1:electron_api_app.cc(1840)] requestAppPermissions cached
- [2022-01-17 18:05:09.530]-[VERBOSE1:electron_api_app.cc(1840)] apiPolicyPreProcessor rejecting from policy 'notifications' from platform_bare_bones_example main_component
The above show us what permission to add, in this case its the 'notifications' API that is being rejected. Now add the permission to the manifest at the platform, defaultWindowOptions and defaultViewOptions levels:
"platform": {
"uuid": "platform_bare_bones_example",
"permissions": {
"webAPIs": [
"notifications"
]
},
"defaultWindowOptions": {
"permissions": {
"webAPIs": [
"notifications"
]
}
},
"defaultViewOptions": {
"permissions": {
"webAPIs": [
"notifications"
]
}
}
},
Please see more details in Configure with a Manifest
If this still fails to work please add this permission to the desktop owners settings file:
{
"applicationSettings": {
"http://localhost:5555/app.json": {
"permissions": {
"webAPIs": [
"notifications"
]
}
}
}
}
Please see more details in Configure Desktop Owner settings
Comments
0 comments
Please sign in to leave a comment.