# @aws-sdk/token-providers

> A collection of token providers

Latest version **3.1136.0** (published 2026-09-18) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @aws-sdk/token-providers
pnpm add @aws-sdk/token-providers
yarn add @aws-sdk/token-providers
bun add @aws-sdk/token-providers
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.1136.0 |
| Published | 2026-09-18 |
| First published | 2022-08-26 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20.0.0 |
| Dependencies | 6 |
| Unpacked size | 37.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3667 |
| Author | AWS SDK for JavaScript Team |
| Maintainers | amzn-oss, aws-sdk-bot |
| Keywords | aws, token |

## Links

- npm: https://www.npmjs.com/package/@aws-sdk/token-providers
- Repository: https://github.com/aws/aws-sdk-js-v3
- Homepage: https://github.com/aws/aws-sdk-js-v3/tree/main/packages/token-providers
- Issues: https://github.com/aws/aws-sdk-js-v3/issues
- npm.io page: https://npm.io/package/@aws-sdk/token-providers

## Dependencies (6)

- [tslib](https://npm.io/package/tslib.md) ^2.6.2
- [@smithy/core](https://npm.io/package/@smithy/core.md) ^3.33.3
- [@aws-sdk/core](https://npm.io/package/@aws-sdk/core.md) ^3.978.0
- [@smithy/types](https://npm.io/package/@smithy/types.md) ^4.17.2
- [@aws-sdk/types](https://npm.io/package/@aws-sdk/types.md) ^3.974.5
- [@aws-sdk/nested-clients](https://npm.io/package/@aws-sdk/nested-clients.md) ^3.997.45

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 3.1136.0 (latest) — 2026-09-18
- 3.1135.0 — 2026-09-17
- 3.1134.0 — 2026-09-16
- 3.1133.0 — 2026-09-15
- 3.1132.0 — 2026-09-14
- 3.1131.0 — 2026-09-11
- 3.1130.0 — 2026-09-10
- 3.1129.0 — 2026-09-09
- 3.1128.0 — 2026-09-08
- 3.1127.0 — 2026-09-04
- 3.1126.0 — 2026-09-03
- 3.1125.0 — 2026-09-02
- 3.1124.0 — 2026-09-01
- 3.1123.0 — 2026-08-31
- 3.1122.0 — 2026-08-31
- … 450 more at https://npm.io/package/@aws-sdk/token-providers/versions

## README

# @aws-sdk/token-providers

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

A collection of all token providers. The token providers should be used when the authorization
type is going to be token based. For example, the `bearer` authorization type set using
[httpBearerAuth trait][http-bearer-auth-trait] in Smithy.

## Static Token Provider

```ts
import { fromStatic } from "@aws-sdk/token-providers";

const token = { token: "TOKEN" };
const staticTokenProvider = fromStatic(token);

const staticToken = await staticTokenProvider(); // returns { token: "TOKEN" }
```

## SSO Token Provider

```ts
import { fromSso } from "@aws-sdk/token-providers";

// returns token from SSO token cache or ssoOidc.createToken() call.
const ssoToken = await fromSso();
```

## Env Token Provider with Signing Name

```ts
import { fromEnvSigningName } from "@aws-sdk/token-providers";

// returns token from environment, where token's key is based on signing name.
const envSigningNameToken = await fromEnvSigningName({ signingName: "signing name" });
```

## Token Provider Chain

```ts
import { nodeProvider } from "@aws-sdk/token-providers";

// returns token from default providers.
const token = await nodeProvider();
```

[http-bearer-auth-trait]: https://smithy.io/2.0/spec/authentication-traits.html#smithy-api-httpbearerauth-trait

---

### Development

This package contains a minimal copy of the SSO OIDC client, instead of relying on the full client, which
would cause a circular dependency.

When regenerating the bundled version of the SSO OIDC client, run the esbuild.js script and then make the following changes:

- Remove any dependency of the generated client on the credential chain such that it would create
  a circular dependency back to this package. Because we only need the `CreateTokenCommand`, the client, and this command's
  associated `Exception`s, it is possible to remove auth dependencies.
- Ensure all required packages are declared in the `package.json` of token-providers.

---
_Source: https://npm.io/package/@aws-sdk/token-providers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
