sts:AssumeRoleWithWebIdentity.
This page uses AWS Lambda as the primary example. Other AWS application types can use the same OIDC flow with their own service-specific execution role and application configuration.
Step 1: Set up an Environment
To configure the variables you need to use in an AWS application, make sure you have the latest version of the 1Password desktop app, then create a new 1Password Environment with your secrets or add your secrets to an existing Environment.Step 2. Connect your Environment to an AWS IAM workload
After you’ve set up an Environment and added your secrets, you can connect the Environment to an AWS IAM workload:- Open your Environment, then select Connect in the AWS IAM section.
- Enter a name for your workload, then choose the integration for the AWS account you need.
- Enter the ARN of the IAM role your workload uses, for example
arn:aws:iam::123456789012:role/example-lambda-role. Use the role ARN, not an assumed-role ARN or a Lambda function ARN. - (Optional) Define any additional access conditions you want to enforce, like a specific Lambda function ARN or principal tags.
- Select Add workflow.
- Make note of the workload ID and Environment ID. You’ll need them in your workload’s configuration.
Step 3: Allow your application’s role to request an OIDC token
Your application’s IAM role needs permission to callsts:GetWebIdentityToken for the audience your administrator configured. Add a policy like this to the role, replacing <expected-audience> with the exact audience value:
sts:GetWebIdentityToken doesn’t support resource-level permissions, so Resource must be "*". The audience and duration conditions limit what the role can request.
For Lambda, keep the standard Lambda execution-role trust relationship with lambda.amazonaws.com. Other AWS application types should use their normal service trust relationship.
If you retrieve the integration key from AWS Secrets Manager at runtime, the application role also needs permission to call secretsmanager:GetSecretValue for that specific secret. If the secret uses a customer-managed KMS key, the role may also need the corresponding kms:Decrypt permission. These permissions are separate from sts:GetWebIdentityToken.
Step 4: Use your Environment in your application
After you’ve connected your Environment, create a 1Password SDK client configured with a function that fetches an OIDC token from AWS STS. The client authenticates using that token, your 1Password workload ID, and the integration key configured by your administrator, then retrieves secrets from your Environment using the Environment ID.1Password Credential Broker is only supported in the 1Password JavaScript SDK at this time.
Usage example
The following example shows how you can use a 1Password JavaScript SDK client in an AWS Lambda function to load an API token from your Environment, then use it to call an external API. Before you run the example, install the dependencies:- Use the Lambda execution role you connected in step 2, with the policy from step 3.
- Configure the four environment variables on the function. This example reads the integration key from an environment variable for simplicity. You can also retrieve it at runtime from wherever your administrator stored it, like AWS Secrets Manager.
- Package
@1password/sdkand@aws-sdk/client-stswith the function, or provide them through a Lambda layer. The AWS SDK version included in the Lambda runtime may not supportGetWebIdentityTokenCommand. - Don’t log the OIDC token, the integration key, or any secret values.
Get help
If you don’t see AWS IAM as a destination in the 1Password desktop app, make sure your administrator has connected your AWS account to your 1Password account. If AWS STS returnsAccessDenied, make sure outbound identity federation is enabled for your AWS account, your role has the policy from step 3, and the audience you request exactly matches the policy. An organization service control policy (SCP) can also deny the action.
If 1Password rejects the request, make sure the role ARN you connected in step 2 matches the role your application runs as, the audience matches exactly, and your 1Password workload ID and integration key come from the same integration.
If your Lambda function times out and is attached to a VPC, make sure it has an outbound path to AWS STS and the 1Password API.