How to validate if a URL is an Okta domain?
I'm looking for a simple code solution to determine whether a given URL belongs to an Okta domain.
Most Okta domains follow these patterns:
example.oktapreview.com
example.okta.com
example.okta-emea.com
However, some Okta domains can be custom and don't adhere to these structures.
What's the most straightforward way to implement this validation, considering both standard and custom Okta domains?
Thanks in advance :)
One of the most straightforward ways will likely be pattern matching using regex on the URL to test for the patterns you have already noted. A pattern that should work on the domains you noted would be \w+\.okta(preview|-emea)?\.com
For Custom domains, since they are implemented using DNS CNAMEs (docs), you should be able to do a DNS lookup to get the actual underlying example.okta.com / example.oktapreview.com / example.okta-emea.com
domain, then use pattern matching on that domain as above.