add router
This commit is contained in:
@@ -30,13 +30,11 @@ export function meta({}: Route.MetaArgs) {
|
||||
}
|
||||
|
||||
export async function action({ request, context }: Route.ActionArgs) {
|
||||
const issuerUrl = context.cloudflare.env.ISSUER_URL
|
||||
const issuerUrl = new URL('/session', context.cloudflare.env.ISSUER_URL)
|
||||
const formData = Object.fromEntries(await request.formData())
|
||||
const url = new URL(request.url)
|
||||
url.pathname = '/authorize'
|
||||
|
||||
try {
|
||||
const r = await fetch(`${issuerUrl}/session`, {
|
||||
const r = await fetch(issuerUrl.toString(), {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@@ -44,6 +42,9 @@ export async function action({ request, context }: Route.ActionArgs) {
|
||||
body: JSON.stringify(formData)
|
||||
})
|
||||
|
||||
const url = new URL(request.url)
|
||||
url.pathname = '/authorize'
|
||||
|
||||
const headers = new Headers(r.headers)
|
||||
headers.set('Location', url.toString())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user