This guide walks you through setting up Auth0 from scratch to work with the AWS Cognito Identity Pool for Bedrock access.
- Create Auth0 Account
- Access Dashboard
- Create Native Application
- Configure Application
- Create Test Users
- Assign Users to Application
- Collect Required Information
- Test the Setup
If you don't have an Auth0 account:
- Go to https://auth0.com/signup
- Fill out the registration form:
- Email address
- Password
- Company (optional)
- Click Sign Up
- Choose your region (US, EU, AU, or JP)
- Create your tenant:
- Tenant Domain:
your-name(becomesyour-name.auth0.com) - Region: Select based on your location
- Tenant Domain:
- Click Create Account
Note: Save your tenant domain - you'll need it for configuration!
- Log in to your Auth0 Dashboard at
https://manage.auth0.com - You'll see the main dashboard with navigation on the left
- Your tenant name is displayed in the top left
- In the Dashboard, navigate to Applications → Applications
- Click + Create Application button
- Enter:
- Name:
Amazon Bedrock CLI Access - Choose an application type: Select Native
- Name:
- Click Create
After creation, you'll see:
- Client ID: Something like
aBcDeFgHiJkLmNoPqRsTuVwXyZ123456 - Domain: Your tenant domain like
your-name.auth0.com
Important: Copy the Client ID - you'll need it for the configuration!
- In your application settings, find Application URIs
- Set Allowed Callback URLs:
http://localhost:8400/callback - Set Allowed Logout URLs (optional):
http://localhost:8400/logout
- Scroll to Refresh Token Rotation
- Enable Rotation
- Enable Rotation Reuse Interval (recommended: 30 seconds)
- In Advanced Settings → Grant Types
- Ensure these are enabled:
- ✅ Authorization Code
- ✅ Refresh Token
Click Save Changes at the bottom of the page
- In the Dashboard, go to User Management → Users
- Click + Create User button
Fill in the form:
- Email:
testuser@example.com - Password: Enter a secure password
- Repeat Password: Confirm the password
- Connection: Username-Password-Authentication (default)
Click Create
Repeat to create more test users:
developer1@example.comdeveloper2@example.com
By default, all users have access to all applications in Auth0. To restrict access:
- Go to Actions → Flows → Login
- Click + → Build Custom
- Name:
Restrict Bedrock Access - Add code to check user email/metadata
- Deploy the Action
For enterprise deployments:
- Go to Organizations
- Create an organization
- Add users to the organization
- Enable the organization for your application
You now have everything needed for deployment:
| Parameter | Your Value | Example |
|---|---|---|
| Auth0Domain | Your Auth0 domain | your-name.auth0.com |
| Auth0ClientId | Your Client ID | aBcDeFgHiJkLmNoPqRsTuVwXyZ123456 |
The CLI accepts multiple formats for the Auth0 provider domain:
| Format | Example | Notes |
|---|---|---|
| Standard domain | company.auth0.com |
Recommended - Standard Auth0 domain |
| Regional domain (US) | company.us.auth0.com |
US-based Auth0 tenant |
| Regional domain (EU) | company.eu.auth0.com |
European Auth0 tenant |
| Regional domain (AU) | company.au.auth0.com |
Australia Auth0 tenant |
| Regional domain (JP) | company.jp.auth0.com |
Japan Auth0 tenant |
Important:
- Do NOT include
https://prefix - the system adds this automatically - Do NOT include trailing slash - the OIDC provider URL is constructed automatically
- Just provide the domain name (e.g.,
company.auth0.com)
When running poetry run ccwb init, you'll be prompted for these values:
poetry run ccwb init
# The wizard will ask for:
# - Auth0 Domain: your-name.auth0.com (your domain from above)
# - Client ID: aBcDeFgHiJkLmNoPqRsTuVwXyZ123456 (your Client ID from above)
# - AWS Region for infrastructure: us-east-1
# - Bedrock regions: us-east-1,us-west-2
# - Enable monitoring: Yes/NoThe CLI tool will handle all the CloudFormation configuration automatically.
- Go back to your application in Auth0
- Check the Settings tab
- Verify:
- Application Type: Native
- Allowed Callback URLs:
http://localhost:8400/callback - Token Endpoint Authentication Method: None
curl https://your-name.auth0.com/.well-known/openid-configurationShould return a JSON response with OIDC endpoints.
- Go to Monitoring → Logs
- Look for:
- Successful Login
- Failed Login (for troubleshooting)
- Ensure the callback URL is exactly:
http://localhost:8400/callback - No trailing slashes or HTTPS
- Check if user exists and password is correct
- Verify application is active
- Check for any Rules or Actions blocking access
- Go to Applications → Applications
- Click on your application
- Client ID is at the top of the Settings tab
- Ensure Authorization Code grant type is enabled
- Check that PKCE is not explicitly disabled
- Verify refresh token settings
If you encounter errors like:
Member must satisfy regular expression pattern: [\w+=,.@-]*
This is automatically handled by the credential provider. Auth0 commonly uses pipe-delimited format in user IDs (e.g., auth0|12345), which AWS doesn't allow in session names. The credential provider sanitizes these characters automatically by replacing them with hyphens.
What this means for you:
- This is a known Auth0 characteristic and is handled automatically
- No configuration changes needed
- Session names are automatically sanitized to meet AWS requirements
- User authentication will work seamlessly
If you encounter deployment errors related to the Auth0Domain parameter:
Cause: The Auth0 domain format doesn't match the expected pattern.
Solution:
- Ensure you're using just the domain name:
company.auth0.com - Don't include
https://or trailing slash - Verify the regional suffix if using a regional tenant (
.us,.eu,.au,.jp) - The domain must be a valid Auth0 domain
Valid examples:
- ✅
company.auth0.com - ✅
company.us.auth0.com - ❌
https://company.auth0.com - ❌
company.auth0.com/
Once you've completed this Auth0 setup:
- Clone the repository:
git clone https://github.com/aws-solutions-library-samples/guidance-for-claude-code-with-amazon-bedrock.git cd claude-code-setup poetry install - Run the setup wizard:
poetry run ccwb init - Create a distribution package:
poetry run ccwb package - Test the deployment:
poetry run ccwb test --api - Distribute the
dist/folder to your users
-
Production Considerations:
- Enable MFA for all users
- Use Auth0 Organizations for enterprise deployments
- Set appropriate session and token lifetimes
- Monitor logs regularly
-
Token Settings:
- Enable refresh token rotation
- Set token expiration to 8 hours or less
- PKCE is automatically enabled for native apps
-
User Management:
- Use Auth0's password policies
- Enable brute-force protection
- Set up anomaly detection
- Regular access reviews
For production environments:
- Go to Settings → Custom Domains
- Add your domain (e.g.,
auth.company.com) - Verify DNS settings
- Update your application configuration
To include user metadata in tokens:
- Go to Actions → Flows → Login
- Create a custom Action
- Add claims to the ID token:
exports.onExecutePostLogin = async (event, api) => { api.idToken.setCustomClaim('email', event.user.email); api.idToken.setCustomClaim( 'department', event.user.user_metadata.department, ); };
For SSO with corporate identity providers:
- Go to Authentication → Enterprise
- Choose your connection type (SAML, OIDC, etc.)
- Configure according to your IdP requirements
- Enable for your application
- Dashboard:
https://manage.auth0.com/dashboard - Applications:
https://manage.auth0.com/dashboard/applications - Users:
https://manage.auth0.com/dashboard/users - Logs:
https://manage.auth0.com/dashboard/logs
Remember to navigate to the correct tenant if you have multiple!