Created a simple hybrid app. Only have the following in the code
function wlCommonInit() {
WL.Client.connect({
onSuccess: function() {alert ("OK");},
onFailure: function (string) {alert ("fail" + string);}
});
}
I created a mobile web environment.
After I did a Build All Environment, Run it on the Server. I right click on the mobile web environment > Preview
I kept getting a pop up alert saying "Access Denied" with a button named reload
I moved to my iphone and in the safari, typed in the URL for the mobile web. I got exactly the same error on my iphone.
You haven't told us what version of MobileFirst Platform Foundation you are using, but I am guessing that it is 7.1.
In 7.1, a new Session-Independent Mode was introduced, and is turned on by default. However, session-independent mode is not supported in browser-based environments (such as mobile web). If you try to use an app that's configured for session-independent mode in an environment that doesn't support it, you will get this error. If you want to create an app in 7.1 that uses a browser-based environment, you'll need to disable session-independent mode.
If you go into your project's "worklight.properties" file, set (or change) these values:
mfp.session.independent=false
mfp.attrStore.type=HttpSession
and then rebuild/deploy your project, it should work.
Please see the doc page I've linked above for further information about session-independent mode.