Auth0 Home Blog Docs

Getting 401 Cross origin login not allowed when trying to authenticate in Cordova hybrid iOS app

cordova
login
hybrid

#1

I am trying to integrate auth0 to my Cordova hybrid iOS app, trying to run it in simulator.

I am using the angular-auth0 thin wrapper from here (https://github.com/auth0/angular-auth0), trying to follow the sample code on that page

Did include the auth0.auth0 module, init the angularAuth0 with my domain and client ID

Whitelist the callback URL to com.XXXXX.YYYYY://[domain]/cordova/com.XXXXXX.YYYYYY/callback

Set the CORS to file://*

In the controller,

        $scope.auth0.login(AUTH0_OPTIONS, function (err, result) {
            console.log("Error when trying to login : %o", err);
            console.log("Error result : %o", result);
        });

When I hit the button to login, I am getting 401 with Cross origin login not allowed

{error: "unauthorized_client", error_description: "Cross origin login not allowed."}

in the log from auth0 web site

  "date": "2017-09-14T05:23:33.334Z",
  "type": "fco",
  "description": "Origin file:// is not allowed.",
...
  "date": "2017-09-14T05:23:33.335Z",
  "type": "fcoa",
  "description": "Cross origin login not allowed.",
  "connection_id": "",

Can someone please help me?

Thanks.


#2

Make sure you have enabled this under `Client -> Settings -> Advanced -> Oauth (tab)

![alt text][1]


#3

When I enable the Cross Origin Authentication, it is asking me to enter a URL for Cross-Origin Verification Fallback with HTTPS scheme, but once again, I am doing a Cordova hybrid app, so HTTP doesn’t apply because it’s running an “app”, not a webpage.

Any idea?


#4