# CORS error calling passwordless from Cordova

**URL:** <https://community.auth0.com/t/cors-error-calling-passwordless-from-cordova/6564>\
**Category:** Get Help\
**Tags:** spa, cordova, cors, passwordless, ios\
**Created:** [May 10, 2017, 8:10pm UTC](https://community.auth0.com/t/cors-error-calling-passwordless-from-cordova/6564 "2017-05-10T20:10:54Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![fredguth](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fredguth/32/6573_2.png) [@fredguth](https://community.auth0.com/u/fredguth)\
**Post date:** [May 10, 2017, 8:10pm UTC](https://community.auth0.com/t/cors-error-calling-passwordless-from-cordova/6564/1 "2017-05-10T20:10:54Z")

</div>

Context:

- SPA
- Hybrid
- Using Cordova and WKWebview
- _Not using Locks_
- Passwordless login

Our app works fine in the web, but the same code base is getting an _auth0_ error in iOS (Cordova). To prevent sending a null origin, we use cordova-local-webserver.

During the passwordless login, we have a POST to https://{app}.auth0.com/passwordless/start which generates the following log:

* * *

```
{
  "date": "2017-05-10T12:38:16.181Z",
  "type": "fco",
  "description": "Origin http://localhost:49634 is not allowed.",
  "connection_id": "",
  "ip": "189.6.84.54",
  "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E304 (4392531984)",
  "details": {
    "xhr": false,
    "method": "OPTIONS",
    "origin": "http://localhost:49634",
    "allowedOrigins": 
      "https://manage.auth0.com",
      "https://auth0.com/docs",
      "https://login.auth0.com",
      "https://docs.auth0.com",
      "https://manage.auth0.com"
    ],
    "headers": {
      "x-forwarded-proto": "https",
      "x-forwarded-for": "189.6.84.54, 127.0.0.1",
      "host": "remoto.auth0.com",
      "content-length": "0",
      "origin": "http://localhost:49634",
      "access-control-request-method": "POST",
      "access-control-request-headers": "auth0-client,content-type",
      "accept": "*/*",
      "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E304 (4392531984)",
      "referer": "http://localhost:49634/www/index.html?cdvToken=0F82EE55-BA72-4E73-B822-53D4F7656018-2355-000003C10FA3DE7F",
      "accept-language": "en-us",
      "accept-encoding": "gzip, deflate"
    },
    "host": "https://remoto.auth0.com",
    "originalUrl": "/passwordless/start"
  },
  "log_id": "49560429270835143462029482507958217094351368046241644546"
}

```

* * *

why are the allowed origins:

> “allowedOrigins”:  
> “[https://manage.auth0.com](https://manage.auth0.com)”,  
> “[Auth0 Documentation - Auth0 Docs](https://auth0.com/docs)”,  
> “[https://login.auth0.com](https://login.auth0.com)”,  
> “[https://docs.auth0.com](https://docs.auth0.com)”,  
> “[https://manage.auth0.com](https://manage.auth0.com)”  
> ],

shouldn’t they be the ones I setup in dashboard?

---

<div class="post-metadata">

**Author:** ![fredguth](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fredguth/32/6573_2.png) [@fredguth](https://community.auth0.com/u/fredguth)\
**Post date:** [May 11, 2017, 3:02am UTC](https://community.auth0.com/t/cors-error-calling-passwordless-from-cordova/6564/2 "2017-05-11T03:02:55Z")

</div>

@abhishek.hingnikar could you help me on this?

---

<div class="post-metadata">

**Author:** ![Abhishek\_Hingnikar1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Abhishek\_Hingnikar1](https://community.auth0.com/u/Abhishek_Hingnikar1)\
**Post date:** [May 11, 2017, 3:06am UTC](https://community.auth0.com/t/cors-error-calling-passwordless-from-cordova/6564/3 "2017-05-11T03:06:16Z")

</div>

On it, although for Cordova and derivatives on mobile you should be using [https://github.com/docs/auth0-cordova](https://github.com/docs/auth0-cordova) and you’ll need to update the hosted login page to use Auth0Lock Passwordless. This is to enforce better security measures on Cordova / Native apps using PKCE.

---

<div class="post-metadata">

**Author:** ![Abhishek\_Hingnikar1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Abhishek\_Hingnikar1](https://community.auth0.com/u/Abhishek_Hingnikar1)\
**Post date:** [May 11, 2017, 5:04am UTC](https://community.auth0.com/t/cors-error-calling-passwordless-from-cordova/6564/4 "2017-05-11T05:04:44Z")

</div>

Hi Fred, I noticed a lot of your apps are using the client, you should not be using that additionally please don’t use wildcard ports that i think is whats causing the issue, with the repository I linked you’ll not need to use Cordova server on the device as Native apps do not enforce CORS restrictions. Additionally, all your clients should be a separate client .

---

<div class="post-metadata">

**Author:** ![fredguth](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fredguth/32/6573_2.png) [@fredguth](https://community.auth0.com/u/fredguth)\
**Post date:** [May 12, 2017, 12:21am UTC](https://community.auth0.com/t/cors-error-calling-passwordless-from-cordova/6564/5 "2017-05-12T00:21:25Z")

</div>

@abhishek.hingnikar You brought some issues to discussion. Let’s separate them.

1. using auth0-cordova + auth0Lock Passwordless: I am understanding that to use auth0-cordova, I will have to use Lock. If so, this is not possible because we have a very different user flow.

2)wildcard: Do you mean using wildcard in Client \> Settings \> Allowed Origins (CORS)? Because I removed wildcards and still get the same error.

3)…

---

<div class="post-metadata">

**Author:** ![fredguth](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fredguth/32/6573_2.png) [@fredguth](https://community.auth0.com/u/fredguth)\
**Post date:** [May 12, 2017, 12:21am UTC](https://community.auth0.com/t/cors-error-calling-passwordless-from-cordova/6564/6 "2017-05-12T00:21:39Z")

</div>

…  
3) Different clients: My app has one codebase and different deployments: web, osx (via electron), ios/android (via cordova). And that is why I didn’t create a different client id for each deployment. we see them as one app. We did, though, create a different client-id for development and it is in a different account.

---

<div class="post-metadata">

**Author:** ![fredguth](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fredguth/32/6573_2.png) [@fredguth](https://community.auth0.com/u/fredguth)\
**Post date:** [May 15, 2017, 7:29pm UTC](https://community.auth0.com/t/cors-error-calling-passwordless-from-cordova/6564/7 "2017-05-15T19:29:13Z")

</div>

@abhishek.hingnikar Any news on this? Besides, our “Dashboard \> Logs” is empty?!?? What happened?

---

<div class="post-metadata">

**Author:** ![Abhishek\_Hingnikar1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Abhishek\_Hingnikar1](https://community.auth0.com/u/Abhishek_Hingnikar1)\
**Post date:** [May 16, 2017, 1:12am UTC](https://community.auth0.com/t/cors-error-calling-passwordless-from-cordova/6564/8 "2017-05-16T01:12:10Z")

</div>

Even though its the same code base the grant types are different an SPA should use implicit while a native app should use PKCE and so on.

---

<div class="post-metadata">

**Author:** ![Abhishek\_Hingnikar1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Abhishek\_Hingnikar1](https://community.auth0.com/u/Abhishek_Hingnikar1)\
**Post date:** [May 16, 2017, 1:14am UTC](https://community.auth0.com/t/cors-error-calling-passwordless-from-cordova/6564/9 "2017-05-16T01:14:23Z")

</div>

1. You don’t have to use Lock you can use the same logic using Auth0.js however, it’ll need some work on the hosted page (passwordless lock is still using Auth0.js#v7) you can have the same logic.

2. That seems to be weird. Can you check in network logs what it is actually sending the call as ? I’ll contact you on email to setup a call and lets debug this in parts.

---

<div class="post-metadata">

**Author:** ![khoa.tran](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@khoa.tran](https://community.auth0.com/u/khoa.tran)\
**Post date:** [January 9, 2018, 10:11am UTC](https://community.auth0.com/t/cors-error-calling-passwordless-from-cordova/6564/10 "2018-01-09T10:11:28Z")

</div>

view comment here [http://community.auth0.com/answers/13630/view](http://community.auth0.com/answers/13630/view)

---

<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:53am UTC](https://community.auth0.com/t/cors-error-calling-passwordless-from-cordova/6564/11 "2018-03-02T05:53:49Z")

</div>


