Auth0 Home Blog Docs

Cordova Phonegap login authentication link problem

Hi @James.Morrison, thank you so much for posting the udpate.
We would really like to solve this problem ASAP and use the Auth0 in our project.

Do you and your dev team have any suggestion what we should do to make this work. We are more than happy to share the project/code with you your team just to get this done.

Thanks,
Dejan

Good morning @dsel and @dejan, I apologize for the late response as I’ve been out of the office and working with other members of our teams to try to figure out where the breakdown might be located.

This very well maybe a listener problem as your app should have registered itself as a listener to the your_app_package:// scheme and open upon successful redirect which its not currently

When you get a chance can you run this:

cordova plugin add cordova-plugin-safariviewcontroller
cordova plugin add cordova-plugin-customurlscheme --variable URL_SCHEME={application package name} --variable ANDROID_SCHEME={application package name} --variable ANDROID_HOST={auth0 domain} --variable ANDROID_PATHPREFIX=/cordova/{application package name}/callback

And confirm your config.xml should have something along these lines as well:

<preference name="AndroidLaunchMode" value="singleTask" />
<plugin name="cordova-plugin-customurlscheme" spec="~4.2.0">
<variable name="URL_SCHEME" value="com.auth0.cordova.example" />
<variable name="ANDROID_SCHEME" value="com.auth0.cordova.example" />
<variable name="ANDROID_HOST" value="[sample.auth0.com](http://sample.auth0.com/)" />
<variable name="ANDROID_PATHPREFIX" value="/cordova/com.auth0.cordova.example/callback" />
</plugin>
<plugin name="cordova-plugin-safariviewcontroller" spec="~1.4.6" />

These details and shared here on the Github Repo requirements.

Please take a look at this and let me know if it helps you move forward. Thanks!

hi @James.Morrison, thanks for the answer but we’re still experiencing same issue.

I’ll try to be as specific as possible, for the first line I’ve put following values:

cordova plugin add cordova-plugin-customurlscheme --variable URL_SCHEME=com.socialwebsuite.app --variable ANDROID_SCHEME=com.socialwebsuite.app --variable ANDROID_HOST=sws-test --variable ANDROID_PATHPREFIX=/cordova/com.socialwebsuite.app/callback

and for the config.xml we have put following options:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.socialwebsuite.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Social Web Suite</name>
<description>
    All in one social media management app.
</description>
<content src="index.html" />
<preference name="AndroidLaunchMode" value="singleTask" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="19" />
<access origin="*" />
<allow-intent href="*" />
<allow-navigation href="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
    <allow-intent href="market:*" />
</platform>
<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
    <icon src="sws.png" width="180" height="180" />
</platform>
<icon src="sws.png" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<plugin name="cordova-plugin-customurlscheme" spec="~4.2.0">
  <variable name="URL_SCHEME" value="com.socialwebsuite.app" />
  <variable name="ANDROID_SCHEME" value="com.socialwebsuite.app" />
  <variable name="ANDROID_HOST" value="[sws-test.auth0.com](http://sws-test.auth0.com/)" />
  <variable name="ANDROID_PATHPREFIX" value="/cordova/com.socialwebsuite.app/callback" />
</plugin>
<plugin name="cordova-plugin-safariviewcontroller" spec="~1.4.6" />

can you please check out those values and if needed just verify them against our profile settings, as we are maybe missing something?

Alright, give this a go and let me know if this helps push things along.

Adjust your ANDROID_HOST to match the following:

cordova plugin add cordova-plugin-customurlscheme --variable URL_SCHEME=com.socialwebsuite.app --variable ANDROID_SCHEME=com.socialwebsuite.app --variable ANDROID_HOST=sws-test.auth0.com --variable ANDROID_PATHPREFIX=/cordova/com.socialwebsuite.app/callback

and in the config.xml file

<variable name="ANDROID_HOST" value="[[sws-test.auth0.com](http://sws-test.auth0.com/)](http://sws-test.auth0.com/)" />

should be:
<variable name="ANDROID_HOST" value="sws-test.auth0.com" />

Hi @James.Morrison, thanks for the quick response, unfortunately after applying your suggestions we’re still having the issue, it hangs on redirect and it can’t find way home to the app.

I’ve reinstalled cordova-plugin-customurlscheme with new parameters and I changed config.xml so it looks like

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.socialwebsuite.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Social Web Suite</name>
<description>
    All in one social media management app.
</description>
<content src="index.html" />
<preference name="AndroidLaunchMode" value="singleTask" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="19" />
<access origin="*" />
<allow-intent href="*" />
<allow-navigation href="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
    <allow-intent href="market:*" />
</platform>
<platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
    <icon height="180" src="sws.png" width="180" />
</platform>
<icon src="sws.png" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<plugin name="cordova-plugin-safariviewcontroller" spec="~1.4.6" />
<plugin name="cordova-plugin-customurlscheme" spec="~4.2.0">
    <variable name="URL_SCHEME" value="com.socialwebsuite.app" />
    <variable name="ANDROID_SCHEME" value="com.socialwebsuite.app" />
    <variable name="ANDROID_HOST" value="sws-test.auth0.com" />
    <variable name="ANDROID_PATHPREFIX" value="/cordova/com.socialwebsuite.app/callback" />
</plugin>

@dsel can you snag us a new HAR file with the added changes you’ve made? Thanks in advance!

After looking over the latest HAR file, everything continues to look good on the Auth0 side of things which points to still how the app is handling the session. Previously you mentioned you would be willing to share the code/repo. Can you send me a link to it in a direct message so we can do a quick overview to see if we find anything? Thanks!

hi @James.Morrison sure we can share the code, can you just drop us an email address in private message so we can give you access to repo.

Thanks.

1 Like

Sent :slightly_smiling_face:

hi @James.Morrison just wanted to follow up with you to check do you have any updates on the issue?

Sent update/request via Direct message regarding the investigation.