fix: only use oauth redirects and add website to app registration details
This commit is contained in:
parent
98a647f8ca
commit
81732a4a8c
3 changed files with 27 additions and 19 deletions
|
@ -7,7 +7,6 @@ import { parseURL } from 'ufo'
|
|||
import { $fetch } from 'ohmyfetch'
|
||||
import type { Storage } from 'unstorage'
|
||||
|
||||
import { isCI } from 'std-env'
|
||||
import cached from './cache-driver'
|
||||
|
||||
import type { AppInfo } from '~/types'
|
||||
|
@ -32,18 +31,17 @@ else {
|
|||
apiToken: config.cloudflare.apiToken,
|
||||
})))
|
||||
}
|
||||
export function getRedirectURI(server: string) {
|
||||
return `${HOST_URL}/api/${server}/oauth`
|
||||
}
|
||||
|
||||
async function fetchAppInfo(server: string) {
|
||||
const redirect_uris = [
|
||||
'urn:ietf:wg:oauth:2.0:oob',
|
||||
`${HOST_URL}/api/${server}/oauth`,
|
||||
].join('\n')
|
||||
|
||||
const app: AppInfo = await $fetch(`https://${server}/api/v1/apps`, {
|
||||
method: 'POST',
|
||||
body: {
|
||||
client_name: APP_NAME + (isCI ? '' : ' (dev)'),
|
||||
redirect_uris,
|
||||
client_name: APP_NAME + (config.env === 'local' ? ' (dev)' : ''),
|
||||
website: 'https://elk.zone',
|
||||
redirect_uris: getRedirectURI(server),
|
||||
scopes: 'read write follow push',
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue