//native
type Clerk = {
apiKey: string;
};
/**
* Update an OAuth application
* Updates an existing OAuth application
*/
export async function main(
auth: Clerk,
oauth_application_id: string,
body: { name?: string; callback_url?: string; scopes?: string },
) {
const url = new URL(
`https://api.clerk.com/v1/oauth_applications/${oauth_application_id}`,
);
const response = await fetch(url, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.apiKey,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 428 days ago