//native
type Xata = {
apiKey: string
}
/**
* delete an access apiKey for a third party app
* Expires the access apiKey for a third party app
*/
export async function main(auth: Xata, apiKey: string) {
const url = new URL(`https://api.xata.io/user/oauth/apiKeys/${apiKey}`)
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 428 days ago