{"id":3395,"library":"alibabacloud-credentials-api","title":"Alibaba Cloud Credentials API (Interface Definition)","description":"The `alibabacloud-credentials-api` library (version 1.0.0) is identified as the Alibaba Cloud Gateway SPI (Service Provider Interface) SDK Library for Python. It primarily serves as an interface definition package, setting the groundwork for credential provider implementations rather than offering direct end-user credential management. This library is typically a dependency for more comprehensive credential management solutions, such as `alibabacloud-credentials`. It is actively maintained with a focus on defining core credential interfaces for the Alibaba Cloud ecosystem.","status":"active","version":"1.0.0","language":"en","source_language":"en","source_url":"https://github.com/aliyun/alibabacloud-credentials-api","tags":["alibaba cloud","credentials","spi","api","authentication","interface"],"install":[{"cmd":"pip install alibabacloud-credentials-api","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"This library is an SPI, meaning it defines interfaces for other libraries (like `alibabacloud-credentials`) to implement. Developers typically interact with higher-level credential management libraries.","symbol":"ICredentialsProvider","correct":"This package primarily defines interfaces; direct import for end-user functionality is uncommon."}],"quickstart":{"code":"# The 'alibabacloud-credentials-api' library primarily defines interfaces (Service Provider Interface).\n# It does not typically offer direct, executable quickstart code for end-users.\n# For managing Alibaba Cloud credentials and obtaining access keys/tokens, \n# please refer to the 'alibabacloud-credentials' library documentation.\n# Example of how to use a *related* credential client (from alibabacloud-credentials):\n# import os\n# from alibabacloud_credentials.client import Client as CredentialClient\n# from alibabacloud_credentials.models import Config as CredentialConfig\n\n# config = CredentialConfig(\n#    type='access_key',\n#    access_key_id=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', ''),\n#    access_key_secret=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', '')\n# )\n# try:\n#    cred = CredentialClient(config)\n#    print(f\"Access Key ID: {cred.get_access_key_id()}\")\n#    # In a real scenario, you would use 'cred' to sign API requests.\n# except Exception as e:\n#    print(f\"Error initializing credentials: {e}\")\n\nprint(\"alibabacloud-credentials-api is an interface definition library.\")\nprint(\"It is typically used by other libraries that implement Alibaba Cloud credential providers.\")\nprint(\"For direct credential management, refer to 'alibabacloud-credentials'.\")\n","lang":"python","description":"As an SPI (Service Provider Interface) library, `alibabacloud-credentials-api` primarily defines interfaces for other modules to implement, such as `ICredentialsProvider`. It does not offer typical direct quickstart code for end-user applications. The example provided illustrates how a related credential management library (`alibabacloud-credentials`) would typically be used, demonstrating the high-level interaction with Alibaba Cloud credentials via environment variables."},"warnings":[{"fix":"If you are looking to manage Alibaba Cloud credentials (e.g., using AccessKey, STS, RAM roles), you should primarily use the `alibabacloud-credentials` library instead. Consult its documentation for usage patterns.","message":"This package ('alibabacloud-credentials-api') is primarily an interface definition (SPI) library. End-users typically interact with actual credential management implementations provided by `alibabacloud-credentials` or other SDK components, not directly with `alibabacloud-credentials-api`. Expect minimal direct runnable examples for this specific package.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure your project uses Python 3.7 or newer to maintain compatibility with the broader Alibaba Cloud Python SDK ecosystem.","message":"Starting from `alibabacloud-credentials` version 1.0rc1 (a related core credential library, not this API package directly), Python 3.7 and above is required. While `alibabacloud-credentials-api` itself is 1.0.0, ensure your Python environment meets the requirements of any consuming libraries.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Store credentials in environment variables (e.g., `ALIBABA_CLOUD_ACCESS_KEY_ID`, `ALIBABA_CLOUD_ACCESS_KEY_SECRET`), configuration files (`~/.alibabacloud/credentials.ini`), or leverage RAM roles for enhanced security and auto-refreshing temporary credentials.","message":"Never hardcode AccessKey IDs and Secrets directly in your application code. This poses a significant security risk, especially if committed to version control. Prefer using environment variables or other secure configuration methods.","severity":"gotcha","affected_versions":"*"},{"fix":"Implement temporary credentials using STS tokens and RAM roles. The `alibabacloud-credentials` library supports various mechanisms like `RamRoleArn` and `EcsRamRole` for this purpose.","message":"Using long-term AccessKey pairs for production applications is generally discouraged due to higher security risks. Temporary Security Token Service (STS) tokens obtained via RAM roles are recommended for most use cases, as they have limited permissions and configurable expiration times.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}