0

Get an OAuth application

by
Published Oct 17, 2025

### Authorization A service token must have at least one of the following access in order to use this API endpoint: **Service Token Accesses** `read_oauth_applications`

Script planetscale Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Planetscale = {
3
  serviceTokenId: string;
4
  serviceToken: string;
5
};
6
/**
7
 * Get an OAuth application
8
 * 
9
### Authorization
10
A service token   must have at least one of the following access   in order to use this API endpoint:
11

12
**Service Token Accesses**
13
 `read_oauth_applications`
14

15

16
 */
17
export async function main(
18
  auth: Planetscale,
19
  organization: string,
20
  application_id: string,
21
) {
22
  const url = new URL(
23
    `https://api.planetscale.com/v1/organizations/${organization}/oauth-applications/${application_id}`,
24
  );
25

26
  const response = await fetch(url, {
27
    method: "GET",
28
    headers: {
29
      Authorization: `${auth.serviceTokenId}:${auth.serviceToken}`,
30
    },
31
    body: undefined,
32
  });
33
  if (!response.ok) {
34
    const text = await response.text();
35
    throw new Error(`${response.status} ${text}`);
36
  }
37
  return await response.json();
38
}
39