Auth0Client with localhost

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?

Hi @Alistair-Clough,

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

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.

@Alistair-Clough,

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

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

1 Like

Thanks for providing your solution

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

1 Like

Sounds good, we are looking forward to it.

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;

Great thanks for providing an update.

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