@@ -7,6 +7,7 @@ import { getServerSession } from 'next-auth'
77import {
88 checkFingerprintConflict ,
99 createCliSession ,
10+ getCliAuthCodeForToken ,
1011 getSessionTokenFromCookies ,
1112 hasCliSessionForAuthHash ,
1213} from './_db'
@@ -91,7 +92,9 @@ const Onboard = async ({ searchParams }: PageProps) => {
9192 )
9293 }
9394
94- const { fingerprintId, expiresAt, receivedHash } = parseAuthCode ( authCode )
95+ const resolvedAuthCode = ( await getCliAuthCodeForToken ( authCode ) ) ?? authCode
96+ const { fingerprintId, expiresAt, receivedHash } =
97+ parseAuthCode ( resolvedAuthCode )
9598 const { valid, expectedHash : fingerprintHash } = validateAuthCode (
9699 receivedHash ,
97100 fingerprintId ,
@@ -103,6 +106,8 @@ const Onboard = async ({ searchParams }: PageProps) => {
103106 logger . warn (
104107 {
105108 authCodeLength : authCode . length ,
109+ resolvedAuthCode : resolvedAuthCode !== authCode ,
110+ resolvedAuthCodeLength : resolvedAuthCode . length ,
106111 dotCount : authCode . match ( / \. / g) ?. length ?? 0 ,
107112 hyphenCount : authCode . match ( / - / g) ?. length ?? 0 ,
108113 fingerprintIdPrefix : fingerprintId . slice ( 0 , 24 ) ,
0 commit comments