Skip to content

Commit

Permalink
ENG-0000 fix(portal): changes httpOnly logic to false (#933)
Browse files Browse the repository at this point in the history
- Updates the cookie check logic to `httpOnly` to `false`
- Wraps the `verifyPrivyAccessToken` in a try/catch block
  • Loading branch information
jonathanprozzi authored Nov 19, 2024
1 parent 4c6fd22 commit 0972d7d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
17 changes: 11 additions & 6 deletions apps/portal/app/.server/privy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ export const verifyPrivyAccessToken = async (
const privy = getPrivyClient()
const authToken = getPrivyAccessToken(req)
if (!authToken) {
logger('No privy access token found')
logger('No Privy access token found')
return null
}
try {
const verifiedClaims = await privy.verifyAuthToken(
authToken,
process.env.PRIVY_VERIFICATION_KEY,
)
return verifiedClaims
} catch (error) {
logger('Error verifying Privy access token', error)
return null
}
const verifiedClaims = await privy.verifyAuthToken(
authToken,
process.env.PRIVY_VERIFICATION_KEY,
)
return verifiedClaims
}

// takes user privy DID (e.g. authCheck().userId)
Expand Down
4 changes: 2 additions & 2 deletions apps/portal/app/routes/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import { Address } from 'viem'

// Create a cookie instance to handle the test cookie
const privySessionCookie = createCookie('privy-session', {
httpOnly: true,
httpOnly: false,
secure: true,
sameSite: 'strict',
path: '/',
domain: 'portal.intuition.systems',
domain: '.portal.intuition.systems',
})

export async function loader({ request }: LoaderFunctionArgs) {
Expand Down

0 comments on commit 0972d7d

Please sign in to comment.