Creating Client Password (Python, NodeJS) Credentials
This guide provides step-by-step instructions for creating and configuring a Keycloak client for CodeMie Client Password integration.
note
You can use scripts to create and manage User Password clients in Keycloak: User Password Script
Prerequisites
- Administrator access to Keycloak
Step 1: Access the Keycloak Admin Console
- Log into the Keycloak admin console with your administrator credentials
- Select the appropriate realm from the dropdown in the top-left corner (e.g.,
codemie-prod)
Step 2: Navigate to the Clients Section
- In the left sidebar menu under "Manage", click on Clients
- Click the Create client button to start the client creation process
Step 3: Configure General Settings
| Field | Value |
|---|---|
| Client Type | OpenID Connect |
| Client ID | codemie-sdk |
| Name | CodeMie SDK |
| Always Display in UI | Off |
Click Next to continue.
Step 4: Configure Capability Config
| Field | Value |
|---|---|
| Client Authentication | Off |
| Authorization | Off |
Authentication Flow:
| Flow | Value |
|---|---|
| Standard flow | On |
| Direct access grants | On |
| Implicit flow | Off |
| OAuth 2.0 Device Authorization Grant | Off |
Click Next to proceed.
Step 5: Configure Login Settings
| Field | Value |
|---|---|
| Root URL | https://codemie.example.com |
| Home URL | |
| Valid Redirect URIs | https://codemie.example.com/* |
| Valid Post Logout Redirect URIs | + |
| Web Origins | https://codemie.example.com |
Click Save to create the client.
Important Note
Make sure to replace the example URLs with your actual CodeMie domain URLs in a production environment.
Step 6: Configure Client Scopes
- After saving the client, click on the client
codemie-sdk - Navigate to the Client Scopes tab in the client settings
- Click on Add client scopes
- Select the
codemiescope from the dropdown and set the assignment type to Default
Step 7: Add to User Password Authorization
- In the left sidebar menu under Manage, click on Users
- Select an existing user or create a new user
- Go to the Credentials tab
- Click on the Set Password button
- Enter the password and confirm it
- Set Temporary to Off
- Click Save to proceed
Step 8: Create Authorization Credentials
Prepare the following credentials to interact with CodeMie services using the SDK:
codemie_api_domain=https://codemie.example.com/code-assistant-api
username=<your-username>
password=<your-password>
auth_client_id=codemie-sdk
auth_realm_name=codemie-prod
auth_server_url=https://keycloak.example.com/auth
verify_ssl=false
Step 9: Start Using CodeMie
You can now interact with CodeMie services such as LLMs, assistants, workflows, and tools using the Python or NodeJS SDK. Follow the SDK documentation for integration details.
Troubleshooting
Common Issues
| Issue | Solution |
|---|---|
| Invalid redirect URI | Ensure that all redirect URIs are correctly configured and match your application settings |
| Authentication failure | Verify that your realm name, client ID, and user credentials are correct |
| Scope issues | Make sure that the codemie scope is properly assigned to your client |