ATlast — you'll never need to find your favorites on another platform again. Find your favs in the ATmosphere.
atproto
16
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix cookies for prod, separate names for dev vs prod

byarielm.fyi ab289b42 24511a41

verified
+15 -12
+2 -2
netlify/functions/core/middleware/auth.middleware.ts
··· 15 15 const cookies = event.headers.cookie 16 16 ? cookie.parse(event.headers.cookie) 17 17 : {}; 18 - const sessionId = cookies.atlast_session; 18 + const sessionId = cookies.atlast_session || cookies.atlast_session_dev; 19 19 20 20 if (!sessionId) { 21 21 throw new AuthenticationError(ERROR_MESSAGES.NO_SESSION_COOKIE); ··· 42 42 const cookies = event.headers.cookie 43 43 ? cookie.parse(event.headers.cookie) 44 44 : {}; 45 - return cookies.atlast_session || null; 45 + return cookies.atlast_session || cookies.atlast_session_dev || null; 46 46 }
+3 -2
netlify/functions/logout.ts
··· 24 24 console.log("[logout] Successfully deleted session:", sessionId); 25 25 } 26 26 27 - const config = getOAuthConfig(); 27 + const config = getOAuthConfig(event); 28 28 const isDev = config.clientType === "loopback"; 29 + const cookieName = isDev ? "atlast_session_dev" : "atlast_session"; 29 30 30 31 const cookieFlags = isDev 31 32 ? `HttpOnly; SameSite=Lax; Max-Age=0; Path=/` ··· 35 36 statusCode: 200, 36 37 headers: { 37 38 "Content-Type": "application/json", 38 - "Set-Cookie": `atlast_session=; ${cookieFlags}`, 39 + "Set-Cookie": `${cookieName}=; ${cookieFlags}`, 39 40 }, 40 41 body: JSON.stringify({ success: true }), 41 42 };
+5 -3
netlify/functions/oauth-callback.ts
··· 43 43 44 44 console.log("[oauth-callback] Created user session:", sessionId); 45 45 46 + const cookieName = isDev ? "atlast_session_dev" : "atlast_session"; 46 47 const cookieFlags = isDev 47 48 ? `HttpOnly; SameSite=Lax; Max-Age=${CONFIG.COOKIE_MAX_AGE}; Path=/` 48 49 : `HttpOnly; SameSite=Lax; Max-Age=${CONFIG.COOKIE_MAX_AGE}; Path=/; Secure`; 49 50 50 - return redirectResponse(`${currentUrl}/?session=${sessionId}`, [ 51 - `atlast_session=${sessionId}; ${cookieFlags}`, 52 - ]); 51 + return redirectResponse( 52 + `${currentUrl}/?session=${sessionId}`, 53 + `${cookieName}=${sessionId}; ${cookieFlags}`, 54 + ); 53 55 }; 54 56 55 57 export const handler = withErrorHandling(oauthCallbackHandler);
+5 -5
netlify/functions/utils/response.utils.ts
··· 45 45 46 46 export function redirectResponse( 47 47 location: string, 48 - setCookies?: string[], 48 + setCookie?: string, 49 49 ): HandlerResponse { 50 - const headers: Record<string, string | string[]> = { 50 + const headers: Record<string, string> = { 51 51 Location: location, 52 52 }; 53 53 54 - if (setCookies && setCookies.length > 0) { 55 - headers["Set-Cookie"] = setCookies; 54 + if (setCookie) { 55 + headers["Set-Cookie"] = setCookie; 56 56 } 57 57 58 58 return { 59 59 statusCode: 302, 60 - headers: headers as HandlerResponse["headers"], 60 + headers, 61 61 body: "", 62 62 }; 63 63 }