跳至內容

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...

已提問 2 年前檢視次數 322 次

2 個答案
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

已回答 2 年前

專家

已審閱 2 年前

0

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

已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。