# Phonegap Authorisation Error On Callback

**URL:** <https://community.auth0.com/t/phonegap-authorisation-error-on-callback/8774>\
**Category:** Get Help\
**Tags:** mobile, callback\
**Created:** [November 18, 2017, 9:45pm UTC](https://community.auth0.com/t/phonegap-authorisation-error-on-callback/8774 "2017-11-18T21:45:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ellissutehall](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@ellissutehall](https://community.auth0.com/u/ellissutehall)\
**Post date:** [November 18, 2017, 9:45pm UTC](https://community.auth0.com/t/phonegap-authorisation-error-on-callback/8774/1 "2017-11-18T21:45:28Z")

</div>

I’m building a mobile application with Phonegap and Framework7. I am attempting to add user authentication with Auth0 having followed the tutorials [here](https://auth0.com/docs/quickstart/native/phonegap/01-login) and [and here](https://auth0.com/docs/quickstart/spa/vanillajs).

I have the InAppBrowser and all auth0 files installed successfully. I have all my client ID and domains etc correctly entered in.  
When I click the login button I am taken off to the hosted login page, my login is remembered so I click my email address and this is where I get the error. The InAppBrowser reports “web page not available [https://matchday-app.eu.auth0.com/login/callback](https://matchday-app.eu.auth0.com/login/callback)? [letters and numbers presumably the access token] could not be loaded net::err\_unsafe\_redirect.”

The weird thing is Phonegap runs on the desktop and mobile and the desktop one logs in perfectly with no problems.  
The Auth0 logs show a sucessful login too (from the phone) so I think it’s just the redirect (callback?) after login which isn’t working, but I have no idea why.

I have scoured the internet for others with this problem and come up with nothing so I would greatly appreciate any help, feedback, suggestions.

Please let me know if there’s any further information required.

Thanks in advance.

Code can be found here: [https://github.com/ellis-sutehall/matchday](https://github.com/ellis-sutehall/matchday)

Allowed callbacks: file:///android\_asset/www/index.html, file:///data/user/0/com.adobe.phonegap.app/files/phonegapdevapp/www/index.html#, [https://matchday-app.eu.auth0.com/mobile](https://matchday-app.eu.auth0.com/mobile), [http://192.168.0.204:3000/#](http://192.168.0.204:3000/#)

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [November 20, 2017, 7:28pm UTC](https://community.auth0.com/t/phonegap-authorisation-error-on-callback/8774/2 "2017-11-20T19:28:38Z")

</div>

Although this should not be relevant to the error in question it’s worth noting that the PhoneGap quickstart is community maintained and may not be up to date. The reason I mention this is that the use of InAppBrowser is not recommended and has been replaced by the use of `auth0-cordova` as seen in some other quickstarts.

Having said that and going back to the error in question you seem to have added the `https://matchday-app.eu.auth0.com/mobile` callback in the application settings like instructed in the quickstart, but then the code is making use of `window.location.href` to set the redirect URI instead of the previous URL so at first glance this is unexpected although I admit I never used the InAppBrowser approach that much to say this would be for sure the problem.

---

<div class="post-metadata">

**Author:** ![ellissutehall](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@ellissutehall](https://community.auth0.com/u/ellissutehall)\
**Post date:** [November 21, 2017, 6:26pm UTC](https://community.auth0.com/t/phonegap-authorisation-error-on-callback/8774/3 "2017-11-21T18:26:10Z")

</div>

Thanks very much for taking the time to have a look and help me it’s greatly appreciated. I haven’t yet had time to implement your suggestions but I will do and feed back soon.

Having read everything I could on the subject before posting my question I am surprised I had not come across anything saying that the way described (using the inappbrowser) was no longer recommended.

I shall look into the new way as well and see if I have more luck.

---

<div class="post-metadata">

**Author:** ![ellissutehall](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@ellissutehall](https://community.auth0.com/u/ellissutehall)\
**Post date:** [November 30, 2017, 12:05am UTC](https://community.auth0.com/t/phonegap-authorisation-error-on-callback/8774/4 "2017-11-30T00:05:34Z")

</div>

So I have gone about this in the new way you suggested and followed the tutorial [here](https://auth0.com/docs/quickstart/native/cordova/01-login).

Annoyingly, I have still been unable to get it to work. I have installed SafariViewController and can confirm that is working.

However, when I compile all the files (using Webpack) I get an error:

App.js:139 Uncaught TypeError: Cannot read property ‘content’ of null

Are you able to help? I have updated the relevant files on the same GitHub link.

As before, any guidance greatly appreciated.

---

<div class="post-metadata">

**Author:** ![ellissutehall](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@ellissutehall](https://community.auth0.com/u/ellissutehall)\
**Post date:** [November 30, 2017, 12:08am UTC](https://community.auth0.com/t/phonegap-authorisation-error-on-callback/8774/5 "2017-11-30T00:08:02Z")

</div>

Messed up the link in previous comment, this is the guide: [Auth0 Cordova SDK Quickstarts: Login](https://auth0.com/docs/quickstart/native/cordova/01-login)

Full error:  
App.js:139 Uncaught TypeError: Cannot read property ‘content’ of null  
at App.render (App.js:139)  
at App.resumeApp (App.js:133)  
at App.run (App.js:78)  
at Channel.main (index.js:12)  
at Channel.fire (cordova.js:777)  
at cordova.js:231

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:57am UTC](https://community.auth0.com/t/phonegap-authorisation-error-on-callback/8774/6 "2018-03-02T05:57:28Z")

</div>


