Netlify CI deploy builds and Auth0 Allowed Callback URLs

My app is hosted/build on Netlify. Every time I make a PR to the source on GitHub, Netlify builds a “deploy build” at the URL “develop-preview-<PR_number>-my-app-name.netlify.app”.

Without needing to go to my Auth0 management console and adding each URL to my “Allowed Callback URLs”, is there a way to have a wildcard in the URL? Something like “*-my-app-name.netlify.app” maybe?

It’s the same issue as this gentleman was having, but his issue went unsolved.

Thanks,
Donavon

Hello @donavon,

Welcome to the Community.

The only wildcard option that would work is:

https://*.netlify.app

Which is obviously a bad idea. Wildcarding a partial name is not supported.

So I’m stuck between two companies. I either convince Auth0 to support wildcarding on partial names or convince Netlify to support develop-preview-<PR_number>.my-app-name.netlify.app (notice the dot before “my-app-name” instead of the dash).

Without one of these, I can’t use deploy preview branches that work against Auth0 (without manual intervention).

Or… a crazy idea is that on a successful Netlify deploy, I hit the Auth0 API to add the deployed URL as an allowed callback. The list would get rather long though (i.e. hundreds of URLs)! Does this API even exist?

You can certainly update the configuration via the API. We ran into the same problem using heroku preview deploys.

For anyone listening, I’ve found this Netlify plug-in. I haven’t implemented it yet, but it looks promising.

More info here:

1 Like

I got this to work!

I created a simple Auth0 managed React app to test how to get Netlify deploy preview functionality working.

We just needed to add the netlify preview URL to these fields in Auth0

  • Allowed Callback URLs ,
  • Allowed Logout URLs , and
  • Allowed Web Origins

Make sure there’s a comma between each URL in the list

Netlify preview URL example:
“https://deploy-preview-*–your-subdomain-12345.netlify.app/”