- Newest
- Most votes
- Most comments
Yes, it is possible to create a sign-up form with custom attributes using Amazon Cognito. However, the built-in UI for Amazon Cognito does not support dropdown menus or radio buttons out of the box. The custom attributes you add in the User Pool are treated as text fields.
To achieve this, you would need to create a custom UI for your sign-up form. You can use the Amazon Cognito SDK in your application to interact with your User Pool. This way, you can design the form however you like, including adding dropdown menus and radio buttons.
Here's a basic example of how you might use the SDK to sign up a new user with custom attributes:
import boto3
client = boto3.client('cognito-idp')
response = client.sign_up(
ClientId='YOUR_COGNITO_APP_CLIENT_ID',
Username='username',
Password='password',
UserAttributes=[
{
'Name': 'custom:attribute1',
'Value': 'value1'
},
{
'Name': 'custom:attribute2',
'Value': 'value2'
},
],
)
In this example, 'custom:attribute1' and 'custom:attribute2' are the custom attributes you've defined in your User Pool, and 'value1' and 'value2' are the values the user has selected or entered in your custom form.
Remember to replace 'YOUR_COGNITO_APP_CLIENT_ID' with your actual Cognito App client ID, and 'username' and 'password' with the user's actual username and password.
This approach gives you full control over the sign-up process, allowing you to implement any form controls you need.
Relevant content
- asked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
Thank you @Ercan -flightlesstux-. That really helped. Is there a way we can retrieve user details along with custom attributes in access-token as encrypted on successful login?