Skip to content

Cognito custom url without access to subdomain?

0

If you own a domain such as example.com and can create a subdomain auth.example.com, then AWS cognito lets you use your domain. Good.

But this is not always the case. Here we are a small business working for a big company. The bigcompany.com trusts us to manage app.bigcompany.com with a CNAME: app.bigcompany.com -> app.bigcompany.smallbiz.com. We control the smallbiz.com DNS, not the bigcompany.com one. In fact we have a double CNAME app.bigcompany.com -> app.bigcompany.smallbiz.com app.bigcompany.smallbiz.com -> AWS ALB

In other words, we cannot create auth.app.bigcompany.com, and creating a temp A record for app.bigcompany.com is just going to take too much time in a bureaucratic process.

Is there really no option to create a custom URL from the app domain? Something like https://app.bigcompany.com/auth?

That seems quite a limitation...

asked 2 years ago300 views

2 Answers
1

Unfortunately, in the scenario you've described, there isn't a straightforward way to create a custom URL for Amazon Cognito using the app domain as you've suggested (like https://app.bigcompany.com/auth).

Amazon Cognito's custom domain feature requires you to have control over the domain or subdomain you want to use. The service is designed to work with a fully qualified domain name (FQDN) that you own and can manage DNS records for.

In your case, where you don't have control over the bigcompany.com domain or the ability to create subdomains under it, you're limited in your options for creating a custom Cognito URL.

The default option in this situation would be to use the Amazon Cognito prefix domain. This domain is hosted on amazoncognito.com and follows the format:

https://[your-prefix].auth.[aws-region].amazoncognito.com

While this doesn't provide the seamless branded experience you're looking for, it is a functional solution that doesn't require additional domain control.

If using the Cognito prefix domain is not acceptable for your use case, you might need to explore alternative solutions. These could include:

  1. Working with the big company to set up the necessary subdomain (auth.app.bigcompany.com) and delegating control to you.

  2. Using a different authentication solution that allows more flexibility in URL structure.

  3. Implementing a proxy solution on your end that could route /auth requests to the Cognito endpoint, though this would require careful security considerations.

It's worth noting that this limitation is in place partly for security reasons, ensuring that the authentication domain is properly controlled and secured. While it can be inconvenient in situations like yours, it helps maintain the integrity of the authentication process.
Sources
Using the Amazon Cognito prefix domain for managed login - Amazon Cognito

answered 2 years ago

EXPERT

reviewed 2 years ago

0

Could you generate a working example for the proxy solution, using nginx on the frontend and nodejs on the backend?

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.