Skip to content

Commit

Permalink
fix: Use custom user-agent in token provisioner (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnauorriols authored Dec 20, 2023
1 parent 8453ce0 commit b0e3db4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/utils/access_token.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { interruptSpinner, wait } from "./spinner.ts";
import { error } from "../error.ts";
import { endpoint } from "./api.ts";
import { endpoint, USER_AGENT } from "./api.ts";
import tokenStorage from "./token_storage.ts";

export default {
Expand Down Expand Up @@ -28,7 +28,11 @@ async function provision(): Promise<string> {

const tokenStream = await fetch(
`${endpoint()}/api/signin/cli/access_token`,
{ method: "POST", body: claimVerifier },
{
method: "POST",
headers: { "User-Agent": USER_AGENT },
body: claimVerifier,
},
);
if (!tokenStream.ok) {
error(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
PushDeploymentRequest,
} from "./api_types.ts";

const USER_AGENT =
export const USER_AGENT =
`DeployCTL/${VERSION} (${Deno.build.os} ${Deno.osRelease()}; ${Deno.build.arch})`;

export interface RequestOptions {
Expand Down

0 comments on commit b0e3db4

Please sign in to comment.