IBM COS SDK for JavaScript V2 - v1.0.0
    Preparing search index...
    • Creates a credential provider that uses IBM IAM authentication.

      This provider takes an input credential provider and enhances it with IBM IAM token authentication by exchanging an API key for a bearer token. The token is automatically cached and refreshed by the IBM Cloud SDK Core.

      Parameters

      • inputProvider: AwsCredentialIdentityProvider

        The credential provider that supplies the API key

      • Optionalinit: FromIamInit

        Optional configuration

      Returns AwsCredentialIdentityProvider

      A credential provider that includes IBM IAM session tokens

      import { fromIam } from "@ibm-cos/credential-providers"; // ES6 import
      // const { fromIam } = require("@ibm-cos/credential-providers"); // CommonJS import
      import { S3Client } from "ibm-cos-sdk-v2";

      const client = new S3Client({
      credentials: fromIam(() => Promise.resolve({
      apiKey: 'your-api-key',
      serviceInstanceId: 'your-service-instance-id'
      }))
      });