aws-amplify / aws-amplify/amplify-cli
update custom domain for cognito
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
**Describe the bug**
Amplify provides a domain like `https://xxxxx.auth.us-east-2.amazoncognito.com` as Cognito domain, I am able to add my own domain. I want to update this custom domain as the default domain used by amplify. Every time I push or pull the changes my `amplifyconfiguration.dart` file updates with the `WebDomain` provided by Cognito, and I need to manually update it, to use my own custom domain.
[link to the issue comment](https://github.com/aws-amplify/amplify-cli/issues/1880#issuecomment-912656978)
> any updates on this? It is almost 1 year earlier request and still pending. I am facing this issue in flutter. For flutter, it generates a amplifyconfiguration.dart file, which is a string export. And every time I make a amplify push, it automatically changes the WebDomain value in this file. so I need to manually go to this file after each push and update the domain with my custom domain. This should be fixed soon, or at least please anyone tell me a workaround for this.
## amplifyconfiguration.dart [File which I need to update after each push]
```
const amplifyconfig = ''' {
"UserAgent": "aws-amplify-cli/2.0",
"Version": "1.0",
"api": {
"plugins": {
"awsAPIPlugin": {
"appnamebackend": {
"endpointType": "GraphQL",
"endpoint": "https://nxxxxxxxxxxxxxe.appsync-api.us-east-2.amazonaws.com/graphql",
"region": "us-east-2",
"authorizationType": "API_KEY",
"apiKey": "dx2-xxxxxxxxxxxxxxxa"
}
}
}
},
"auth": {
"plugins": {
"awsCognitoAuthPlugin": {
"UserAgent": "aws-amplify-cli/0.1.0",
"Version": "0.1.0",
"IdentityManager": {
"Default": {}
},
"AppSync": {
"Default": {
"ApiUrl": "https://xxxxxxxxxxxxxxxxe.appsync-api.us-east-2.amazonaws.com/graphql",
"Region": "us-east-2",
"AuthMode": "API_KEY",
"ApiKey": "dx2-zxxxxxxxxxxxxxaa",
"ClientDatabasePrefix": "appname_API_KEY"
},
"appnamebackend_AWS_IAM": {
"ApiUrl": "https://appname.appsync-api.us-east-2.amazonaws.com/graphql",
"Region": "us-east-2",
"AuthMode": "AWS_IAM",
"ClientDatabasePrefix": "appname_AWS_IAM"
},
"appname_AMAZON_COGNITO_USER_POOLS": {
"ApiUrl": "https://nxxxxxxxxxxxxxxcde.appsync-api.us-east-2.amazonaws.com/graphql",
"Region": "us-east-2",
"AuthMode": "AMAZON_COGNITO_USER_POOLS",
"ClientDatabasePrefix": "appname_AMAZON_COGNITO_USER_POOLS"
}
},
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "us-east-2:e1xxxxxxxxxxxxxxx155",
"Region": "us-east-2"
}
}
},
"CognitoUserPool": {
"Default": {
"PoolId": "us-east-2_hYSWWnA6x",
"AppClientId": "98cxxxxxxxxxx0lk64k",
"Region": "us-east-2"
}
},
"Auth": {
"Default": {
"OAuth": {
"WebDomain": "auth.appname.in", // <-------------------------it chages to https://appname-
staging/auth.us.-east-2.amazoncognito.com
"AppClientId": "98cxxxxxxxxxx0lk64k",
"SignInRedirectURI": "appname://",
"SignOutRedirectURI": "appname://",
"Scopes": [
"phone",
"email",
"openid",
"profile",
"aws.cognito.signin.user.admin"
]
},
"authenticationFlowType": "USER_SRP_AUTH",
"loginMechanism": [],
"signupAttributes": [
"EMAIL"
],
"passwordProtectionSettings": {
"passwordPolicyMinLength": 8,
"passwordPolicyCharacters": [
"REQUIRES_LOWERCASE",
"REQUIRES_NUMBERS",
"REQUIRES_SYMBOLS",
"REQUIRES_UPPERCASE"
]
},
"mfaConfiguration": "OFF",
"mfaTypes": [
"SMS"
]
}
},
"S3TransferUtility": {
"Default": {
"Bucket": "appname-staging",
"Region": "us-east-2"
}
}
}
}
},
"storage": {
"plugins": {
"awsS3StoragePlugin": {
"bucket": "appname-staging",
"region": "us-east-2",
"defaultAccessLevel": "guest"
}
}
}
}''';
```
Contributor guide
Research direction
Start by tracing how amplifyconfiguration.dart is generated and where the Cognito WebDomain value is selected during amplify push and pull. Verify the behavior with the Flutter configuration shown in the issue; done means a configured custom domain is preserved instead of being replaced by the Cognito-provided domain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, flutter, typescript
- Domain
- authentication, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100