opened
rorysedgwick
username_0
**Describe the bug**
Passing a custom domain to Auth.configure( ) is not honoured when the `CognitoUserPool `constructor is called in the `amazon-cognito-identity-js` library. Requests are still routed to `cognito-idp.[region].amazonaws.com`.

**@aws-amplify v1.2.10**
**amazon-cognito-identity-js v3.0.3**

**To Reproduce**
Steps to reproduce the behavior:
1. Pass an `endpoint` parameter to `Amplify.configure( )`
2. Make a request using the configured `Client`
3. Observe network traffic routing to `cognito-idp.[region].amazonaws.com`
4. In `@aws-amplify/auth/lib/Auth.js`: pass `endpoint: config.Auth.endpoint` as a `key:value` in the `userPoolData` object on line 106
5. Pass an `endpoint` parameter to `Amplify.configure( ) again`
6. Make a request using the configured `Client`
7. Observe network traffic routing to the custom endpoint provided

**Expected behavior**
Passing a custom endpoint URL to `Amplify.configure( )` should pass this value to the `CognitoUserPool` constructor, where the `Client` is instantiated with the provided URL (see `amazon-cognito-identity-js/src/Client.js:20-23`.

The `CognitoUserPool` constructor clearly expects to optionally receive a custom endpoint, as it is destructured out of the provided `data` parameter (see `amazon-cognito-identity-js/src/CognitoUserPool.js:49-69`), and passed to the `new Client( )` invocation. However, when the `CognitoUserPool` constructor is called by `Amplify.configure( )`, it is only passed the `UserPoolId` and `ClientId` parameters and therefore ignores a custom endpoint.

Monkey patching `@aws-amplify/auth/lib/Auth.js:105:113` so the endpoint parameter is also passed, means that after `Amplify.configure( )` is called, requests are routed to that domain instead of the default cognito-idp domain

**Additional context**
I want to change the default behaviour of Amplify so that all authentication related requests from a mobile app are routed through a custom domain that I own. This is because our corporate networking systems by default block many AWS URLs, and so users on corporate devices cannot sign up, sign in etc. We can whitelist some endpoints but believe the same may be the case for another large corporation that we want to supply the app to employees of. Therefore changing the Cognito endpoint would be preferable.

For example, we would provide something like `auth.[region].mycustomdomain.com` as a custom endpoint, and add a CNAME record at the subdomain that could point to `cognito-idp.[region].amazonaws.com`.
Passing a custom domain to Auth.configure( ) is not honoured when the CognitoUserPool is instantiated
issue
created
brendan-hurley
username_1
I've also encountered this issue, with `@aws-amplify/auth`. We would like to configure a custom endpoint per above issue.
comment