Overview
All OpenStack API requests require a valid bearer token in theX-Auth-Token request header. The Identity service (Keystone) issues tokens upon successful authentication. Tokens are time-limited, project-scoped, and carry the role assignments of the authenticated user.
Prerequisites
- An active Polystack account
- Project name, username, and password (or application credential ID and secret)
- Identity endpoint:
https://api.<your-domain>/identity/v3
Token-Based Authentication
Password Authentication
Authenticate with a username and password to receive a project-scoped token:X-Subject-Tokenheader — the token string to use in subsequent calls- JSON body with token metadata including expiry time and service catalog
Token metadata response (excerpt)
Application Credentials
Application credentials allow services and automation scripts to authenticate without exposing user passwords. They are scoped to a specific project and role set at creation time.- Dashboard
- CLI
Navigate to Application Credentials
Log in to the Polystack Dashboard (
https://connect.<your-domain>) and navigate to
Project → Identity → Application Credentials. Click Create Application Credential.Configure the credential
Download the clouds.yaml
Click Download clouds.yaml to get a ready-to-use configuration file for the
Polystack CLI and Python SDK.
The
clouds.yaml file is saved to your local machine and can be placed at ~/.config/polystack/clouds.yaml.Scoped Tokens
Tokens can be scoped to different resources depending on the operation required:Exchange an Unscoped Token for a Project-Scoped Token
Step 1: Obtain unscoped token
Step 2: List available projects
Step 3: Exchange for project-scoped token
Token Lifecycle
Validate a token
Revoke a token
Tokens expire after the configured token TTL (default: 1 hour). Long-running automation scripts should implement token refresh logic — detect
401 Unauthorized responses and re-authenticate automatically.Using the OpenRC File
For CLI and script use, source an OpenRC credentials file instead of manually passing credentials:Source OpenRC file
Sample OpenRC file content
Troubleshooting
403 Forbidden despite valid token
403 Forbidden despite valid token
Cause: The token is valid but the user’s role does not permit this operation.Resolution: Verify your role assignment in the project:Contact your administrator to assign the appropriate role.
Check role assignments
Token scope mismatch
Token scope mismatch
Cause: The token is scoped to a different project than the resource being accessed.Resolution: Re-authenticate with the correct project scope. Confirm the
OS_PROJECT_NAME environment variable matches the project containing the resource.Next Steps
Compute API
Launch and manage instances using the Compute API
Identity API
Manage users, projects, and roles via the Identity API
Application Credentials
Create and manage application credentials for non-interactive access
