Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
feat: Ability to toggle cookies to work in HTTP (#4194)
Balu Babudf730e4d21e6
diff --git a/.env.example b/.env.exampleindex e9c64eb9d..28feaf08b 100644--- a/.env.example+++ b/.env.example@@ -9,6 +9,9 @@ MAGIC_LINK_TOKEN_VALIDITY= 3REFRESH_TOKEN_VALIDITY="604800000" # Default validity is 7 days (604800000 ms) in msACCESS_TOKEN_VALIDITY="86400000" # Default validity is 1 day (86400000 ms) in msSESSION_SECRET='add some secret here'+# Reccomended to be true, set to false if you are using http+# Note: Some auth providers may not support http requests+ALLOW_SECURE_COOKIES=true# Hoppscotch App Domain ConfigREDIRECT_URL="http://localhost:3000"diff --git a/packages/hoppscotch-backend/src/auth/helper.ts b/packages/hoppscotch-backend/src/auth/helper.tsindex bd2a9fcfd..9c5c051d6 100644--- a/packages/hoppscotch-backend/src/auth/helper.ts+++ b/packages/hoppscotch-backend/src/auth/helper.ts@@ -52,13 +52,13 @@ export const authCookieHandler = (res.cookie(AuthTokenType.ACCESS_TOKEN, authTokens.access_token, {httpOnly: true,- secure: true,+ secure: configService.get('ALLOW_SECURE_COOKIES') === 'true',sameSite: 'lax',maxAge: accessTokenValidity,});res.cookie(AuthTokenType.REFRESH_TOKEN, authTokens.refresh_token, {httpOnly: true,- secure: true,+ secure: configService.get('ALLOW_SECURE_COOKIES') === 'true',sameSite: 'lax',maxAge: refreshTokenValidity,});