# Auth0Client with localhost

**URL:** <https://community.auth0.com/t/auth0client-with-localhost/44427>\
**Category:** Get Help\
**Created:** [June 10, 2020, 5:58am UTC](https://community.auth0.com/t/auth0client-with-localhost/44427 "2020-06-10T05:58:54Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alistair-Clough](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alistair-clough/32/21848_2.png) [@Alistair-Clough](https://community.auth0.com/u/Alistair-Clough)\
**Post date:** [June 10, 2020, 5:58am UTC](https://community.auth0.com/t/auth0client-with-localhost/44427/1 "2020-06-10T05:58:54Z")

</div>

Hi y’all,  
I am setting up login for an SPA. So far so good.  
What I am really struggling with is implementing a locally run service that uses the authClient but doesn’t call Auth0. I can write a wrapper service that bypasses Auth0 pretty easily but that is not ideal.  
Is there an existing pattern for running an AuthClient on localhost?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 12, 2020, 11:29pm UTC](https://community.auth0.com/t/auth0client-with-localhost/44427/3 "2020-06-12T23:29:39Z")

</div>

Hi @Alistair-Clough,

Here are our docs for working with auth0 locally. Have you gone through this?

> **[Test Applications Locally](https://auth0.com/docs/get-started/applications/work-with-auth0-locally)**
>
> Learn how to develop and test Auth0 applications.

---

<div class="post-metadata">

**Author:** ![Alistair-Clough](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alistair-clough/32/21848_2.png) [@Alistair-Clough](https://community.auth0.com/u/Alistair-Clough)\
**Post date:** [June 13, 2020, 2:02am UTC](https://community.auth0.com/t/auth0client-with-localhost/44427/4 "2020-06-13T02:02:54Z")

</div>

Yes thank you. References are always appreciated.  
The step I am trying to avoid is the call to Auth0. I have a mock server already to provide internal endpoints. I was hoping for a way to tell the authClient that it was authorised from config. But this is all very new for me.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 15, 2020, 5:09pm UTC](https://community.auth0.com/t/auth0client-with-localhost/44427/5 "2020-06-15T17:09:32Z")

</div>

@Alistair-Clough,

There is not a way that I know of. You could create a token via [jwt.io](http://jwt.io) and hard code it in your app directly, but that might not be the solution you are looking for.

---

<div class="post-metadata">

**Author:** ![Alistair-Clough](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alistair-clough/32/21848_2.png) [@Alistair-Clough](https://community.auth0.com/u/Alistair-Clough)\
**Post date:** [June 15, 2020, 11:15pm UTC](https://community.auth0.com/t/auth0client-with-localhost/44427/6 "2020-06-15T23:15:12Z")

</div>

Thank you. We have decided to mock the auth0Client using an interface.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 15, 2020, 11:15pm UTC](https://community.auth0.com/t/auth0client-with-localhost/44427/7 "2020-06-15T23:15:40Z")

</div>

Thanks for providing your solution

---

<div class="post-metadata">

**Author:** ![Alistair-Clough](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alistair-clough/32/21848_2.png) [@Alistair-Clough](https://community.auth0.com/u/Alistair-Clough)\
**Post date:** [June 15, 2020, 11:21pm UTC](https://community.auth0.com/t/auth0client-with-localhost/44427/8 "2020-06-15T23:21:47Z")

</div>

I will post a fuller response when I know that it works. 😉

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 16, 2020, 4:28pm UTC](https://community.auth0.com/t/auth0client-with-localhost/44427/9 "2020-06-16T16:28:35Z")

</div>

Sounds good, we are looking forward to it.

---

<div class="post-metadata">

**Author:** ![Alistair-Clough](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alistair-clough/32/21848_2.png) [@Alistair-Clough](https://community.auth0.com/u/Alistair-Clough)\
**Post date:** [June 17, 2020, 12:06am UTC](https://community.auth0.com/t/auth0client-with-localhost/44427/10 "2020-06-17T00:06:46Z")

</div>

A diagram showing the pattern I used to mock SPA for local host. I hope this helps.  
Key functions;  
isAuthenticated(): Promise;  
handleRedirectCallback(url?: string): Promise;  
getUser(options?: any): Promise;  
getToken(): Promise;  
loginWithRedirect(options?): Promise;  
logout(options?: any): void;

 ![image](https://global.discourse-cdn.com/auth0/original/3X/d/2/d20aff3dd70de123ce9179a39c18779eb1562b5b.png)

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [June 17, 2020, 8:21pm UTC](https://community.auth0.com/t/auth0client-with-localhost/44427/11 "2020-06-17T20:21:39Z")

</div>

Great thanks for providing an update.

---

<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:** [July 2, 2020, 8:21pm UTC](https://community.auth0.com/t/auth0client-with-localhost/44427/12 "2020-07-02T20:21:42Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
