//native
type Xata = {
apiKey: string
}
/**
* Get the list of user OAuth Access Tokens
* Retrieve the list of valid OAuth Access Tokens on the current user's account
*/
export async function main(auth: Xata) {
const url = new URL(`https://api.xata.io/user/oauth/apiKeys`)
const response = await fetch(url, {
method: 'GET',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 428 days ago