Skip to content

Commit

Permalink
temporary rename authorize route
Browse files Browse the repository at this point in the history
  • Loading branch information
emiljohansson committed Dec 22, 2024
1 parent 5799dcd commit 0d3c337
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 59 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ out
coverage
pnpm-*
.vercel
.turbo

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
Expand Down
57 changes: 57 additions & 0 deletions apps/next/src/app/api/authorize/x_route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
export async function GET() {}

// import { type NextRequest } from 'next/server'
// import { redirect } from 'next/navigation'
// import crypto from 'crypto'
// import { kv } from '@vercel/kv'

// eslint-disable-next-line @typescript-eslint/no-unused-vars
// export async function GET(request: NextRequest) {
// console.log('GET /login/authorize')
// const authCodes =
// (await kv.get<{
// [key: string]: number
// }>('auth-codes')) || {}
// console.log({ authCodes })

// const responseType = request.nextUrl.searchParams.get('response_type')
// const clientId = request.nextUrl.searchParams.get('client_id')
// const redirectUri = request.nextUrl.searchParams.get('redirect_uri')
// const scope = request.nextUrl.searchParams.get('scope')
// const nonce = request.nextUrl.searchParams.get('nonce')

// console.log({
// responseType,
// clientId,
// redirectUri,
// scope,
// nonce,
// })

// const code = crypto.randomBytes(16).toString('hex')
// authCodes[code] = new Date(Date.now() + 60000).getTime()
// await kv.set('auth-codes', authCodes)

// // const codeVerifier = generateCodeVerifier()
// // const codeChallenge = base64UrlEncode(
// // crypto.createHash('sha256').update(codeVerifier).digest(),
// // )
// // const isMatching = verifyPKCE(codeVerifier, codeChallenge)
// // // console.log({ codeVerifier, codeChallenge, isMatching })
// // // console.log(userAgent({ headers: headers() as Headers }))
// // const authCodes = getCache<{ [key: string]: boolean }>('authCodes')
// // const found = authCodes?.[authCode]

// // if (!found) {
// // return NextResponse.json({
// // enteredCode: authCode,
// // error: 'not found',
// // })
// // }

// const params = new URLSearchParams({
// code,
// })

// return redirect(`${redirectUri}?${params.toString()}`)
// }
55 changes: 0 additions & 55 deletions apps/next/src/app/login/authorize/route.tsx

This file was deleted.

8 changes: 4 additions & 4 deletions apps/next/src/app/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Image from 'next/image'
// import Image from 'next/image'
import Content from '@/components/Content'
import Section from '@/components/Section'

export default function Page() {
return (
<Content>
<Section size="normal" direction="column">
<form
action="/login/authorize"
{/* <form
action="/api/login/authorize"
method="get"
className="bg-white text-black text-center flex flex-col"
>
Expand All @@ -31,7 +31,7 @@ export default function Page() {
<input type="text" placeholder="Email" />
<input type="password" placeholder="Password" />
<button>Continue</button>
</form>
</form> */}
</Section>
</Content>
)
Expand Down

0 comments on commit 0d3c337

Please sign in to comment.