Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 82391

OAuthModule on hybrid apps

$
0
0

Hi, I'm working on implementing OAuthModule on an app I'm working on. I have successfully implemented the OAuthModule by modifying the login.html page in the app (I added the login tables provided from the module's index.html). In the modeler, I have created my custom authentication page. The page uses HTMLSnippet to add login.html to the custom login page. This works well on desktop version. Authenticating using local account, Google account, or Facebook account works well.

However, creating a similar custom authentication page for mobile version does not work. If the social button's href properties are default (which is href="signin/facebook" for example), it will result in an error dialog

Application Error

net::ERR_FILE_NOT_FOUND (file :///android_asset/www/signin/facebook)

and so on for Google and LinkedIn social buttons.

If I set the href properties to link to the application's signin (which is href="https://APPNAME.mxapps.io/signin/facebook" for example), it will result in the hybrid app opening the link in an external browser to authenticate the user, which works. However, it never returns to the hybrid app, instead it continues in the external browser (user is logged in in the external browser but not in hybrid app, and all user interaction continues in external browser). Is there a way to tackle this issue such that authenticating and user activities after that happens inside the hybrid app?

 

EDIT:

I think I have solved the problem. What I need to do is to modify the config.xml file for the phonegap build, add the lines such as below:

<feature name="CDVWKWebViewEngine">
     <param name="ios-package" value="CDVWKWebViewEngine" />
 </feature>

 <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

<access origin="*" />
<allow-navigation href="*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-navigation href="tel:*" />
<allow-navigation href="sms:*" />
<allow-navigation href="mailto:*" />
<allow-navigation href="geo:*" />

 

Then I created a custom widget which executes the line below: 

window.location.href = this.urlRedirect;

 

I want to point out that OAuth using Google account is not possible via hybrid app since Google's OAuth restricts for web browser only. Also, the app cannot remember the user, therefore everytime the user starts the app, the user has to log in again.


Viewing all articles
Browse latest Browse all 82391

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>