Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auth0 in Ionic2 gives Uncaught can't find relay frame in callback

I am trying to get Auth0 working in Browser using

ionic run browser

I have followed the guides from Auth0. I am using

auth0-7.6.1.min.js

lock/10.10.2/lock.min.js

versions. navigation to Google login page happens, but the callback is failing with blank white screen. by call back I mean loading the

https://n00b.au.auth0.com/login/callback?state=blahblahblah...

url. which loads a white html with JavaScript that throws exeption

Uncaught can't find relay frame

in these lines of code

     onOpen: function(cb) {
        var o = "*";
        var msgTarget = isIE ? findRelay() : window.opener;
        if (!msgTarget) throw "can't find relay frame";

clearly a global window.opener property was expected to exist. knowing that this whole URL is served by Auth0, I can't find a way to figure out what is wrong.

I have checked the logs in Auth0 and it is all green from their perspective and shows successful login.

Any Idea why this is failing?

UPDATE: tested on iPhone and iOS Emulator and both only show blank white screen. Downloaded sample Auth0 project and has this issue without any modification. My guess is that it has something to do with InApp Browser plugin of Cordova opening the login page in a new safari window

like image 731
n00b Avatar asked Feb 20 '17 12:02

n00b


1 Answers

I'm currently having problems with the lock opening the registration link in the safari browser instead of in the InAppBrowser. This could be the thing that breaks the callback as it makes you completely switch application to Safari.

I made have a temporary workaround so the sign up link opens in the InAppBrowser, see => App rejected by Apple because Auth0 signUpLink doesn’t open in Cordova InAppBrowser but in system browser (Safari)

You could maybe apply this to your login links to have them open in the InAppBrowser as well.

like image 62
Bryandh Avatar answered Oct 16 '22 07:10

Bryandh