aws-amplify / aws-amplify/amplify-cli
Distinguish between `providerName` and `providerType`
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
Relevant file: ` amplify-cli/packages/amplify-category-auth/resources/cloudformation-templates/auth-template.yml.ejs`
**Is your feature request related to a problem? Please describe.**
I would like to be able to distinguish the 'providerName' from the 'providerType' by passing an additional property in `hostedUIProviderMeta`.
**Describe the solution you'd like**
Example:
- Add functionality to allow users to configure a custom provider of `providerType` "OIDC" but with a `providerName` of "Midway".
By being able to set "Midway" as the `ProviderName` and "OIDC" as the `ProviderType` in `hostedUIProviderMeta` you would you would be able to set the `ProviderDetails` and `requestParams.ProviderType` in `HostedUIProvidersCustomResource` as follows:
```
- ' ProviderDetails: {'
- ' ''client_id'': providerCreds.client_id,'
- ' ''client_secret'': providerCreds.client_secret,'
- ' ''authorize_scopes'': providerMeta.authorize_scopes,'
- ' ''oidc_issuer'': providerMeta.oidc_issuer,'
- ' ''attributes_request_method'': providerMeta.attributes_request_method'
- ' },'
- ' ProviderName: providerMeta.ProviderName,'
- ' ProviderType: providerMeta.ProviderType,'
- ' UserPoolId: userPoolId,'
- ' AttributeMapping: providerMeta.AttributeMapping'
- ' };'
- ' return requestParams;'
- ' };'
- ' let createIdentityProvider = (providerName) => {'
- ' let requestParams = getRequestParams(providerName);'
- ' requestParams.ProviderType = requestParams.ProviderType;'
- ' return identity.createIdentityProvider(requestParams).promise();'
- ' };'
```
This would enable you to configure the `UserPoolClient`s as desired using only CloudFormation and have your `hostedUI` working with a custom provider without having to log into the console to update the settings.
I also remove the following line from `OAuthCustomResource` to only enable my custom "Midway" provider and not the default one.
```
- ' providerList.push(''COGNITO'');'
```
Related Error Messages
```
"1 validation error detected: Value 'Midway' at 'providerType' failed to satisfy constraint: Member must satisfy enum value set: [Facebook, SAML, SignInWithApple, LoginWithAmazon, OIDC, Google]"
```
```
INFO TypeError: Cannot read property 'client_id' of undefined
```
I am currently able to achieve the desired behavior by setting:
`hostedUIProviderCreds[0].ProviderName: "OIDC"` `hostedUIProviderCreds[0].hostedUIProviderMeta: "OIDC"` and `authProvidersUserPool[0] = "OIDC"`, but "OIDC" is not indicative of the name of my custom provider, and also 'ProviderName' and 'ProviderType' are really different properties.
I can submit a pull request, but this type of change should also be documented.
Contributor guide
Assessment
This issue has not been assessed yet.