InfisicalSDKClient. You create the client once, log it in as a machine identity, and then use it for every request.
Create a client
Create the client with the URL of your Infisical instance inhost.
get_secret_by_name and list_secrets return. Creating, updating, or deleting a secret through the client clears the cached secrets. The cache doesn’t see changes made anywhere else, so a secret can be up to cache_ttl seconds old.
The cache keeps one copy of each secret, whatever version, view_secret_value, include_imports, or expand_secret_references you pass to get_secret_by_name. If you pass any of them, set cache_ttl to None.
The cache runs a background thread. To stop the thread when you’re done with the client, call client.close(), or create the client in a with statement:
Log in
The client logs in with one of the machine identity’s authentication methods. After the client logs in, it sends the access token it got with every request.Universal Auth
The client ID of the machine identity’s Universal Auth configuration.
AWS auth
If your application runs on AWS, it can log in through AWS Auth with the AWS credentials it already has:- AWS credentials: the same way boto3 does, such as from environment variables or the IAM role of an EC2 instance or Lambda function
- AWS region: from the
AWS_REGIONenvironment variable, or from the EC2 instance metadata ifAWS_REGIONisn’t set
The ID of the machine identity. If you pass
None, the SDK uses the value of the INFISICAL_AWS_IAM_AUTH_IDENTITY_ID environment variable.OIDC auth
If your identity provider issues OIDC tokens to your application, such as Okta or Auth0, the application can log in through OIDC Auth:LDAP auth
To log in with an LDAP username and password through LDAP Auth:Access token
If your application gets an access token some other way, such as through Token Auth, give the token to the client:client.get_token().
Access token expiry
The SDK doesn’t renew the access token. The token expires after the Access Token TTL set in the machine identity’s auth method. If your application runs longer than that, log in again before the token expires. Thelogin methods except token_auth.login return the token’s details, including its lifetime in seconds in expiresIn: