[400] bad_domain inside Ionic mobile App

I am integrating Stytch inside an Ionic App.
However when I enter my email it gives me error -
[400] bad_domain_for_stytch_sdk

I understand that I need to register my domains in the admin console, however for an Ionic app how do I do this? I have already put my app bundle ID, but it is not working. The ionic app url would be localhost but the port number will be different for everyone. So not sure what url to enter.
Does stytch support Ionic platform? If so what is the solution to authorize Ionic app with Stytch?

Hey Mufaddal – thanks for posting!

We believe that Ionic may be compatible with Stytch, though we don’t have any official resources at the moment and haven’t built an Ionic integration ourselves.

When you say that the localhost port will change for everyone, I assume that’s just during app development – correct? Have you tried adding the URL/ port that you are personally using for development to the Stytch Dashboard?

Hey Nicole,

When the app is loaded on a device inside a webview the url is localhost but the port number is dynamic and can’t be predicted as it depends on open ports on the user’s device. So the actual port number the app will run on can vary between devices even (specially) in production.

Is there a way to disable this security feature and allow any port number? I tried wildcard in the url which works fine, but it does not work for port number like -

Another way is to have a custom capacitor package that can detect the app and use its app Bundle ID instead of url, but that requires explicit support for Ionic platform.

Got it, thanks for the additional context! We don’t allow domain wildcards in our Live environment for security purposes, which isn’t something that can currently be disabled.

I discussed this use case with my team, and it seems like we unfortunately don’t have a great solution for this at the moment – sorry about that. I’ll raise frontend Ionic SDK support internally as a feature request for future consideration!

In the meantime, I believe that you should be able to use a backend Stytch integration without issue. We offer a number of different backend SDKs (including a Node SDK) that should suit your use case. Check out our Backend API docs and let me know if you have any questions!