0

Update an OAuth client

Published Oct 17, 2025

Update information about an OAuth Client on your Account.

Script linode Verified

The script

Submitted by hugo697 Bun
Verified 389 days ago
1
//native
2
type Linode = {
3
  token: string;
4
};
5
/**
6
 * Update an OAuth client
7
 * Update information about an OAuth Client on your Account.
8
 */
9
export async function main(
10
  auth: Linode,
11
  apiVersion: "v4" | "v4beta",
12
  clientId: string,
13
  body: {
14
    id?: string;
15
    label?: string;
16
    public?: false | true;
17
    redirect_uri?: string;
18
    secret?: string;
19
    status?: "active" | "disabled" | "suspended";
20
    thumbnail_url?: string;
21
  },
22
) {
23
  const url = new URL(
24
    `https://api.linode.com/${apiVersion}/account/oauth-clients/${clientId}`,
25
  );
26

27
  const response = await fetch(url, {
28
    method: "PUT",
29
    headers: {
30
      "Content-Type": "application/json",
31
      Authorization: "Bearer " + auth.token,
32
    },
33
    body: JSON.stringify(body),
34
  });
35
  if (!response.ok) {
36
    const text = await response.text();
37
    throw new Error(`${response.status} ${text}`);
38
  }
39
  return await response.json();
40
}
41