Skip to content

Commit

Permalink
fix: extractCookie from GraphiQLHeader (#6894)
Browse files Browse the repository at this point in the history
  • Loading branch information
zaiyou12 committed Nov 16, 2022
1 parent da8710f commit 9581815
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/auth-providers-api/src/dbAuth/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ import * as DbAuthError from './errors'
// names.
// Checks for cookie in headers in dev when user has generated graphiql headers
export const extractCookie = (event: APIGatewayProxyEvent) => {
let cookieFromGraphiqlHeader
if (process.env.NODE_ENV === 'development') {
try {
cookieFromGraphiqlHeader = JSON.parse(event.body ?? '{}').extensions
const cookieFromGraphiqlHeader = JSON.parse(event.body ?? '{}').extensions
?.headers?.cookie
return cookieFromGraphiqlHeader
} catch (e) {
return event.headers.cookie || event.headers.Cookie
}
}
return (
event.headers.cookie || event.headers.Cookie || cookieFromGraphiqlHeader
)
return event.headers.cookie || event.headers.Cookie
}

// decrypts the session cookie and returns an array: [data, csrf]
Expand Down

0 comments on commit 9581815

Please sign in to comment.