Register
Authentication
Register
Register new users in AWS Cognito User Pool
POST
Register
Overview
The register endpoint will allow new users to create accounts in the IGAD Innovation Hub platform. Registration will use AWS Cognito’s sign-up flow with email verification.Planned Implementation
Expected Request
User’s email address. Must be unique and will require verification.Format: Valid email addressExample:
newuser@igad.intUser’s chosen password. Must meet Cognito password requirements:
- Minimum 8 characters
- At least one uppercase letter
- At least one lowercase letter
- At least one number
- At least one special character
SecureP@ssw0rd123User’s full name for display purposes.Example:
John DoeUser’s organization or institution (optional).Example:
IGAD Climate Prediction and Applications CentreUser’s country (optional). Useful for regional analytics.Example:
KenyaExpected Request Example
Expected Response
Success Response (201 Created)
Cognito user identifier (sub).
Registered email address.
Always
false on registration. User must verify email via code.User’s display name.
Instructions for email verification.
Always
true. Indicates user must verify email before login.Expected Success Response Example
Expected Error Responses
400 Bad Request - Email Already Exists
Returned when email is already registered.UsernameExistsException
400 Bad Request - Invalid Password
Returned when password doesn’t meet requirements.InvalidPasswordException
400 Bad Request - Invalid Email Format
Returned when email format is invalid.InvalidParameterException
429 Too Many Requests - Rate Limit Exceeded
Returned when too many registration attempts.TooManyRequestsException
500 Internal Server Error
Returned for unexpected registration failures.Planned Implementation Details
AWS Cognito Sign-Up Flow
The registration will use Cognito’ssign_up API:
Email Verification Flow
After registration:- Cognito sends verification email with 6-digit code
- User must call
/api/auth/verify-emailwith:emailcode
- Account becomes active after verification
- User can then call
/api/auth/login
Custom Attributes
Cognito User Pool should be configured with custom attributes:custom:organization(String, mutable)custom:country(String, mutable)custom:role(String, mutable) - Default: “user”
Custom attributes must be defined in Cognito User Pool before registration endpoint is implemented.
Auto-Confirmation (Optional)
For internal IGAD domains, auto-confirm emails:Email Verification Endpoint (To Be Implemented)
POST /api/auth/verify-email
Request:Resend Verification Code Endpoint (To Be Implemented)
POST /api/auth/resend-verification
Request:Expected Usage Example
JavaScript (Fetch)
Python (Requests)
Current Workaround
Until self-service registration is implemented, users must be created by administrators using:- AWS Console: Cognito User Pools → Users → Create user
- AWS CLI:
- Backend Script: Contact system administrator
Admin-created users must change their temporary password on first login via the
NEW_PASSWORD_REQUIRED challenge.Related Endpoints
- POST /api/auth/login - Login after email verification
- POST /api/auth/verify-email - Verify email with code (to be implemented)
- POST /api/auth/resend-verification - Resend verification code (to be implemented)
- POST /api/auth/forgot-password - Reset password
Implementation Checklist
For Developers: Implementation checklist for registration feature
- Configure Cognito User Pool custom attributes
- Implement
POST /api/auth/registerendpoint - Implement
POST /api/auth/verify-emailendpoint - Implement
POST /api/auth/resend-verificationendpoint - Add rate limiting for registration attempts
- Configure email templates in Cognito
- Add registration form to frontend
- Add email verification UI flow
- Update admin dashboard to disable manual user creation
- Add analytics for registration funnel
- Test with various email providers
- Document registration flow for users
Security Considerations
Password Requirements
Enforce strong password policies:- Minimum 8 characters (consider 12+ for higher security)
- Complexity requirements (uppercase, lowercase, number, special char)
- Check against common password lists
- Prevent reuse of recent passwords
Email Verification
- Verification codes expire after 24 hours
- Limit resend attempts to prevent abuse
- Use Cognito’s built-in email service or configure SES
Rate Limiting
- Limit registration attempts per IP: 5 per hour
- Limit verification attempts: 3 per email per hour
- Implement CAPTCHA for public registration
Data Privacy
- Comply with GDPR and data protection regulations
- Allow users to delete their accounts
- Log registration events for audit trail
- Never store passwords in plain text (Cognito handles this)