Allow the auth cookie in development
This commit is contained in:
		| @@ -49,9 +49,17 @@ async function login({ | |||||||
|     query, |     query, | ||||||
|     { variables } |     { variables } | ||||||
|   ) |   ) | ||||||
|   const cookie = res.headers.get('Set-Cookie') |   // Bigcommerce returns a Set-Cookie header with the auth cookie | ||||||
|  |   let cookie = res.headers.get('Set-Cookie') | ||||||
|  |  | ||||||
|   if (cookie && typeof cookie === 'string') { |   if (cookie && typeof cookie === 'string') { | ||||||
|  |     // In development, don't set a secure cookie or the browser will ignore it | ||||||
|  |     if (process.env.NODE_ENV !== 'production') { | ||||||
|  |       cookie = cookie.replace('; Secure', '') | ||||||
|  |       // SameSite=none can't be set unless the cookie is Secure | ||||||
|  |       cookie = cookie.replace('; SameSite=none', '; SameSite=lax') | ||||||
|  |     } | ||||||
|  |  | ||||||
|     response.setHeader( |     response.setHeader( | ||||||
|       'Set-Cookie', |       'Set-Cookie', | ||||||
|       concatHeader(response.getHeader('Set-Cookie'), cookie)! |       concatHeader(response.getHeader('Set-Cookie'), cookie)! | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ import { Logo, Modal, Button } from '@components/ui' | |||||||
|  |  | ||||||
| export default function Login() { | export default function Login() { | ||||||
|   const signup = useSignup() |   const signup = useSignup() | ||||||
|   // TODO: use this method |   // TODO: use this method. It can take more than 5 seconds to do a signup | ||||||
|   const handleSignup = async () => { |   const handleSignup = async () => { | ||||||
|     // TODO: validate the password and email before calling the signup |     // TODO: validate the password and email before calling the signup | ||||||
|     // Passwords must be at least 7 characters and contain both alphabetic |     // Passwords must be at least 7 characters and contain both alphabetic | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user