How to use @aws-sdk/credential-provider-cognito-identity - 1 common examples

To help you get started, we’ve selected a few @aws-sdk/credential-provider-cognito-identity examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-samples / aws-sdk-js-v3-workshop / Exercise2 / frontend / src / libs / s3Client.ts View on Github external
import { S3Client } from "@aws-sdk/client-s3-browser";
import { fromCognitoIdentityPool } from "@aws-sdk/credential-provider-cognito-identity";
import { CognitoIdentityClient } from "@aws-sdk/client-cognito-identity-browser";
import { config } from "../config";

// Customization pending https://github.com/aws/aws-sdk-js-v3/issues/185
const cognitoIdentityClient = new CognitoIdentityClient({
  region: "us-west-2",
  credentials: () => Promise.resolve({} as any),
  signer: {} as any
});
cognitoIdentityClient.middlewareStack.remove("SIGNATURE");

const s3Client = new S3Client({
  region: "us-west-2",
  credentials: fromCognitoIdentityPool({
    // @ts-ignore
    client: cognitoIdentityClient,
    identityPoolId: config.IdentityPoolId
  })
});

export { s3Client };

@aws-sdk/credential-provider-cognito-identity

[![NPM version](https://img.shields.io/npm/v/@aws-sdk/credential-provider-cognito-identity/latest.svg)](https://www.npmjs.com/package/@aws-sdk/credential-provider-cognito-identity) [![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/credential-provid

Apache-2.0
Latest version published 3 days ago

Package Health Score

100 / 100
Full package analysis

Popular @aws-sdk/credential-provider-cognito-identity functions

Similar packages