Skip to content

Commit

Permalink
Trying to use current url in authorizationCodeGrant
Browse files Browse the repository at this point in the history
  • Loading branch information
spaceo committed Nov 15, 2024
1 parent bf658e0 commit 9063de2
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions app/auth/callback/unilogin/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,15 @@ export interface TIntrospectionResponse extends client.IntrospectionResponse {
export async function GET(request: NextRequest) {
const session = await getSession()
const config = await getUniloginClientConfig()
const currentUrl = new URL(request.url)
const appUrl = goConfig("app.url")
const redirect_uri = `${appUrl}/auth/callback/unilogin`
const appUrl = goConfig<string>("app.url")
const currentUrl = new URL(`${appUrl}/auth/callback/unilogin`)

// Fetch all user/token info.
try {
const tokenSetResponse = await client.authorizationCodeGrant(
config,
currentUrl,
{
pkceCodeVerifier: session.code_verifier,
idTokenExpected: true,
},
{
redirect_uri,
}
)
const tokenSetResponse = await client.authorizationCodeGrant(config, currentUrl, {
pkceCodeVerifier: session.code_verifier,
idTokenExpected: true,
})

const tokenSet = schemas.tokenSet.parse(tokenSetResponse) as TTokenSet

Expand Down

0 comments on commit 9063de2

Please sign in to comment.