export default defineEventHandler(async (event) => {
const token = await $fetch('https://xxx.kinde.com/oauth2/token', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
audience: "https://xxx.kinde.com/api",
grant_type: "client_credentials",
client_id: "xxx",
client_secret: "xxx",
})
}) as { access_token: string };
// I have tried
event.headers.set('authorization', token.access_token);
// I have tried
event.node.req.headers.authorization = token.access_token;
})
export default defineEventHandler(async (event) => {
const token = await $fetch('https://xxx.kinde.com/oauth2/token', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
audience: "https://xxx.kinde.com/api",
grant_type: "client_credentials",
client_id: "xxx",
client_secret: "xxx",
})
}) as { access_token: string };
// I have tried
event.headers.set('authorization', token.access_token);
// I have tried
event.node.req.headers.authorization = token.access_token;
})