chore: wip oauth
This commit is contained in:
parent
6755ed6f94
commit
6ea4879190
8 changed files with 75 additions and 10 deletions
21
server/api/[server]/oauth.ts
Normal file
21
server/api/[server]/oauth.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { getQuery } from 'ufo'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const query = getQuery(event.req.url!)
|
||||
const code = query.code
|
||||
const server = event.context.params.server
|
||||
console.log({ query, server })
|
||||
|
||||
const res = await $fetch(`https://${server}/oauth/token`, {
|
||||
method: 'POST',
|
||||
body: {
|
||||
client_id: 'your_client_id_here',
|
||||
client_secret: 'your_client_secret_here',
|
||||
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
|
||||
grant_type: 'authorization_code',
|
||||
code,
|
||||
scope: 'read write follow push',
|
||||
},
|
||||
})
|
||||
console.log({ res })
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue