Skip to content

Commit

Permalink
fix(experimentalIdentityAndAuth): add strict check for token in `Ht…
Browse files Browse the repository at this point in the history
…tpBearerAuthSigner`
  • Loading branch information
Steven Yuan authored and syall committed Oct 11, 2023
1 parent 940aad5 commit 56bdadd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/great-cycles-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smithy/experimental-identity-and-auth": patch
---

Add strict check for `token` in `HttpBearerAuthSigner`.
3 changes: 3 additions & 0 deletions packages/experimental-identity-and-auth/src/httpBearerAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export class HttpBearerAuthSigner implements HttpSigner {
signingProperties: Record<string, any>
): Promise<IHttpRequest> {
const clonedRequest = httpRequest.clone();
if (!identity.token) {
throw new Error("request could not be signed with `token` since the `token` is not defined");
}
clonedRequest.headers["Authorization"] = `Bearer ${identity.token}`;
return clonedRequest;
}
Expand Down

0 comments on commit 56bdadd

Please sign in to comment.