Skip to content

GetAuthorizationToken

Source: src/AWS/CodeArtifact/GetAuthorizationToken.ts

Runtime binding for codeartifact:GetAuthorizationToken.

Mints a temporary authorization token for the bound domain — the credential package managers (npm, pip, maven, …) present to a CodeArtifact repository endpoint. The deploy-time half grants codeartifact:GetAuthorizationToken on the domain plus the sts:GetServiceBearerToken call CodeArtifact performs on the caller’s behalf. Provide the implementation with Effect.provide(AWS.CodeArtifact.GetAuthorizationTokenHttp).

The returned authorizationToken is wrapped in Redacted so it never leaks into logs — unwrap with Redacted.value(...) at the point of use.

import * as Redacted from "effect/Redacted";
const getToken = yield* AWS.CodeArtifact.GetAuthorizationToken(domain);
const res = yield* getToken({ duration: "1 hour" });
const token = Redacted.isRedacted(res.authorizationToken)
? Redacted.value(res.authorizationToken)
: res.authorizationToken; // pass to `npm config set //…:_authToken=`