createAuth0Client Failing

Hi

I am trying to integrate auth0 with my simple JS web app (just webpack, html, typescript, tailwind css - no SPA frameworks) using the JS SDK.

I’m following the quick start guide but I’m getting the following error when calling createAuth0Client:

Failed to load resource: the server responded with a status of 403 ()

I’m also seeing “FailedSilent Auth” in the Auth0 dashboard logs. I need http://localhost:8080 apparently in the callback URL but the page I’m trying to secure isn’t index.html.

Can I have a callback URL with a path or is only a scheme and authority allowed?

Thanks

Ben

1 Like

Hi @benmsullivan,

Allowed Callback URLs: Make sure to specify the protocol (https://); otherwise, the callback may fail in some cases. With the exception of custom URI schemes for native clients, all callbacks should use protocol https://.

Regarding the error with the quickstart, can you confirm that you are following this quickstart: Auth0 JavaScript SDK Quickstarts: Login? Is your application in the Auth0 tenant set to a Single Page App or Regular Web App? Any screenshots of the errors or code snippets would also be helpful!

Thanks,

Mary Beth

1 Like

Hi @marybeth.hunter

I’ve reproduced the issue here for you (see commands to run in README):

I don’t use https as I’m developing locally as per the Javascript SDK Quickstarts guide.

Thanks!

1 Like

So I think the problem is that the redirect URL for some reason returns a 403 when trying to create the auth0 client in javascript.

CleanShot 2024-12-21 at 09.48.28@2x

If I use http://localhost:8080 for the Allowed Callback URLs in my JS app then I can authenticate.

If I use http://localhost:8080/index.html then creation of auth0 client fails with 403.

Why is that?

I would like to be able to use any valid URL in the Allowed Callback URLs. Is this possible?

Thanks

1 Like

OK figureed it out - needed to add redirect url to createAuthOClient call:

return await createAuth0Client({
domain: config.domain,
clientId: config.clientId,
authorizationParams: {
redirect_uri: ${window.location.origin}/index.html
}
});

1 Like