The alibabacloud-credentials library is the core module for managing authentication credentials within the Alibaba Cloud Python SDK. It provides various credential providers (AccessKey, STS, RAM, EcsRamRole, OAuth, CloudSSO) and handles credential loading from environment variables, configuration files, and metadata services. The current version is 1.0.8, and it maintains a regular release cadence with several patches and minor features per year.
pip install alibabacloud-credentialsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the `DefaultCredentialsProvider` to automatically resolve and retrieve Alibaba Cloud credentials. It first initializes a `Config` object (which can be pre-configured or left empty for automatic resolution) and then creates a `DefaultCredentialsProvider`. It attempts to fetch and print the Access Key ID, Access Key Secret, and Security Token. For actual use, ensure environment variables like `ALIBABA_CLOUD_ACCESS_KEY_ID` and `ALIBABA_CLOUD_ACCESS_KEY_SECRET` are set, or a valid `.aliyun/config.json` file is present.
Upgrade your Python environment to 3.7 or newer. If you must use an older Python, pin your `alibabacloud-credentials` version to `<1.0.6`, but be aware you will miss important bug fixes.
Upgrade to `alibabacloud-credentials` version `1.0.7` or newer to benefit from fixes that increase OAuth token refresh lead time and correctly update OAuth tokens even with source profiles.
Upgrade to `alibabacloud-credentials` version `1.0.2` or newer. Always ensure that the `profile_name` specified in your `Config` or `ALIBABA_CLOUD_PROFILE` environment variable corresponds to an existing profile in your `.aliyun/config.json`.
Instantiate `DefaultCredentialsProvider` without any arguments, for example: `provider = DefaultCredentialsProvider()`. Refer to the library's latest documentation for the correct method to configure credentials with this class.
Ensure the module is installed by running: pip install alibabacloud-credentials
Upgrade to the latest version by running: pip install --upgrade alibabacloud-credentials
Run the following commands to configure your credentials: aliyun configure set --profile <profileName> --access-key-id <yourAccessKeyId> --access-key-secret <yourAccessKeySecret>
Verify the available profiles by running: aliyun configure list
Run the following commands to check and create the credential configuration: aliyun configure list/get; aliyun configure set --profile <PROFILE_NAME> --access-key-id <yourAccessKeyId> --access-key-secret <yourAccessKeySecret>
No dependency data recorded yet.