# Do I need to use ngrok to expose my local server to be contacted by Auth0 during authentication/rules?

**URL:** <https://community.auth0.com/t/do-i-need-to-use-ngrok-to-expose-my-local-server-to-be-contacted-by-auth0-during-authentication-rules/45652>\
**Category:** Get Help\
**Tags:** rules, auth0\
**Created:** [July 1, 2020, 7:27pm UTC](https://community.auth0.com/t/do-i-need-to-use-ngrok-to-expose-my-local-server-to-be-contacted-by-auth0-during-authentication-rules/45652 "2020-07-01T19:27:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![avimoondra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/avimoondra/32/22315_2.png) [@avimoondra](https://community.auth0.com/u/avimoondra)\
**Post date:** [July 1, 2020, 7:27pm UTC](https://community.auth0.com/t/do-i-need-to-use-ngrok-to-expose-my-local-server-to-be-contacted-by-auth0-during-authentication-rules/45652/1 "2020-07-01T19:27:06Z")

</div>

Having trouble setting up Auth0 for local development.

I have a react app running on localhost:3000, that uses `@auth0/auth0-spa-js`

I have a Hasura ([http://hasura.io/](http://hasura.io/)) backend running on localhost:8080.

I’ve turned off “OIDC Conformant” under Advanced Settings of SPA app in Auth0.

I have some Rules that contact the backend over http. So for the Rules to reach my server running locally, I am using ngrok to expose localhost:8080 and pass that url through `createAuth0Client` as a custom param and use that in the Rule, via `context.request.query.backendUrl` as an example.

Is correct in that if I need to talk to my backend in one of the rules, I must expose my localhost:8080 over the public internet so it can be connected to? Or is there another way?

More info here too: [https://hasura.io/docs/1.0/graphql/manual/guides/integrations/auth0-jwt.html#sync-users-from-auth0](https://hasura.io/docs/1.0/graphql/manual/guides/integrations/auth0-jwt.html#sync-users-from-auth0)

Thanks,  
Avi

---

<div class="post-metadata">

**Author:** ![sgo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sgo/32/13789_2.png) [@sgo](https://community.auth0.com/u/sgo)\
**Post date:** [July 6, 2020, 3:01pm UTC](https://community.auth0.com/t/do-i-need-to-use-ngrok-to-expose-my-local-server-to-be-contacted-by-auth0-during-authentication-rules/45652/3 "2020-07-06T15:01:25Z")

</div>

Hi @avimoondra,

[Rules are run on the Auth0 servers](https://auth0.com/docs/best-practices/rules#anatomy), so if you want the rules to output something to your backend they will need to be accessible over the internet, if the backend is only running on your local machine then ngrok would be needed for development purposes. I am not familiar with Hasura personally, but their example seems to rely on a heroku based app’s endpoint being available over the internet.

Please read our [best practices for rules](https://auth0.com/docs/best-practices/rules), for example amongst other things, we recommend to [always use HTTPS](https://auth0.com/docs/best-practices/rules#always-use-https) when making any calls to external services/redirections.

Kind regards,  
Steve

---

<div class="post-metadata">

**Author:** ![avimoondra](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/avimoondra/32/22315_2.png) [@avimoondra](https://community.auth0.com/u/avimoondra)\
**Post date:** [July 7, 2020, 10:18pm UTC](https://community.auth0.com/t/do-i-need-to-use-ngrok-to-expose-my-local-server-to-be-contacted-by-auth0-during-authentication-rules/45652/4 "2020-07-07T22:18:13Z")

</div>

Is there no way to run auth0 locally? How is a backend expected to stay in sync with Auth0 if they do not communicate to each other?

If exposing my backend server locally, I would assume now this server has to now be secured with complex enough user/password combos and/or secrets…

---

<div class="post-metadata">

**Author:** ![sgo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sgo/32/13789_2.png) [@sgo](https://community.auth0.com/u/sgo)\
**Post date:** [July 8, 2020, 3:44pm UTC](https://community.auth0.com/t/do-i-need-to-use-ngrok-to-expose-my-local-server-to-be-contacted-by-auth0-during-authentication-rules/45652/5 "2020-07-08T15:44:04Z")

</div>

I’m afraid there is no way to run Auth0 locally, the Auth0 service needs to be hosted in the cloud (or a private cloud depending on your subscription) - [Deploy and Monitor](https://auth0.com/docs/getting-started/deployment-models)

This means that any backend or service you have that needs to be called from the Auth0 service itself (from rules or custom DB scripts, for example) needs to be reachable over the public network.
