Skip to content

Commit fc1591d

Browse files
committed
changed stuff
1 parent 1642b97 commit fc1591d

11 files changed

Lines changed: 18 additions & 15 deletions

File tree

lib/withAuth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export function withAuth(
8080
"session_token=",
8181
"Path=/",
8282
"HttpOnly",
83-
"SameSite=Strict",
83+
"SameSite=lax",
8484
"Secure",
8585
"Max-Age=0",
8686
].join("; "),
@@ -231,7 +231,7 @@ export function withAuthSsr<
231231
"session_token=",
232232
"Path=/",
233233
"HttpOnly",
234-
"SameSite=Strict",
234+
"SameSite=lax",
235235
"Secure",
236236
"Max-Age=0",
237237
].join("; "),

pages/api/auth/discord/callback.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ export default async function handler(
115115
where: { discordUserId },
116116
});
117117

118+
console.log(existingDiscord)
119+
console.log(req)
118120

119121
const cookies = cookie.parse(req.headers.cookie || "")
120122
const sessionToken = cookies.session_token
@@ -163,13 +165,13 @@ export default async function handler(
163165

164166
res.setHeader(
165167
"Set-Cookie",
166-
`session_token=${session.token}; Path=/; HttpOnly; SameSite=Strict; Max-Age=${60 * 60 * 24 * 7
167-
}; ${process.env.NODE_ENV === "production" ? "Secure;" : ""}`
168+
`session_token=${session.token}; Path=/; HttpOnly; SameSite=lax; Max-Age=${60 * 60 * 24 * 7}; ${process.env.NODE_ENV === "production" ? "Secure;" : ""}`
168169
)
169170

170171
return res.redirect("/")
171172
} catch (err) {
172173
console.error("Discord OAuth error:", err)
174+
console.log("hi")
173175

174176
if (axios.isAxiosError(err)) {
175177
console.error(err.response?.data)

pages/api/auth/google/callback.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export default async function handler(req: AuthenticatedRequest, res: NextApiRes
175175

176176
res.setHeader(
177177
"Set-Cookie",
178-
`session_token=${session.token}; Path=/; HttpOnly; SameSite=Strict; Max-Age=${60 * 60 * 24 * 30}`
178+
`session_token=${session.token}; Path=/; HttpOnly; SameSite=lax; Max-Age=${60 * 60 * 24 * 30}`
179179
)
180180

181181
return res.redirect("/")

pages/api/auth/login.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse<Response>) {
167167
req.headers["user-agent"]
168168
)
169169

170-
res.setHeader('Set-Cookie', `session_token=${session.token}; Path=/; HttpOnly; SameSite=Strict; Max-Age=${60 * 60 * 24 * 30}`)
170+
res.setHeader('Set-Cookie', `session_token=${session.token}; Path=/; HttpOnly; SameSite=lax; Max-Age=${60 * 60 * 24 * 30}`)
171171

172172
const tovyuser: User = {
173173
userId: id,

pages/api/auth/logout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export async function handler(
2323
"session_token=;",
2424
"Path=/;",
2525
"HttpOnly;",
26-
"SameSite=Strict;",
26+
"SameSite=lax;",
2727
"Max-Age=0;",
2828
process.env.NODE_ENV === "production" ? "Secure;" : "",
2929
].join(" ")

pages/api/auth/roblox/callback.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export default async function handler(
163163

164164
res.setHeader(
165165
'Set-Cookie',
166-
`session_token=${session.token}; Path=/; HttpOnly; SameSite=Strict; Max-Age=${
166+
`session_token=${session.token}; Path=/; HttpOnly; SameSite=lax; Max-Age=${
167167
60 * 60 * 24 * 30
168168
}; ${process.env.NODE_ENV === 'production' ? 'Secure;' : ''}`
169169
)

pages/api/auth/roblox/start.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default async function handler(req: AuthenticatedRequest, res: NextApiRes
1515
let clientId: string | undefined;
1616
let redirectUri: string | undefined;
1717
clientId = process.env.ROBLOX_CLIENT_ID;
18-
redirectUri = `${process.env.PLANETARY_CLOUD_URL ? `https://${process.env.PLANETARY_CLOUD_URL}` : process.env.NEXTAUTH_URL || process.env.PUBLIC_URL}/api/auth/discord/callback`;
18+
redirectUri = `${process.env.PLANETARY_CLOUD_URL ? `https://${process.env.PLANETARY_CLOUD_URL}` : process.env.NEXTAUTH_URL || process.env.PUBLIC_URL}/api/auth/roblox/callback`;
1919
if (!clientId || !redirectUri) {
2020
try {
2121
const configs = await prisma.instanceConfig.findMany({

pages/api/auth/signup/finish.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export default async function handler(
9393
req.headers['user-agent']
9494
);
9595

96-
res.setHeader('Set-Cookie', `session_token=${session.token}; Path=/; HttpOnly; SameSite=Strict; Max-Age=${60 * 60 * 24 * 30}`);
96+
res.setHeader('Set-Cookie', `session_token=${session.token}; Path=/; HttpOnly; SameSite=lax; Max-Age=${60 * 60 * 24 * 30}`);
9797

9898
return res.status(200).json({ success: true });
9999
} catch (error) {

pages/api/setupworkspace.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
131131
req.headers['user-agent']
132132
)
133133

134-
res.setHeader('Set-Cookie', `session_token=${session.token}; Path=/; HttpOnly; SameSite=Strict; Max-Age=${60 * 60 * 24 * 7}`)
134+
res.setHeader('Set-Cookie', `session_token=${session.token}; Path=/; HttpOnly; SameSite=lax; Max-Age=${60 * 60 * 24 * 7}`)
135135

136136
res.setHeader('Set-Cookie', [
137-
`session_token=${session.token}; Path=/; HttpOnly; SameSite=Strict; Max-Age=${60 * 60 * 24 * 30}`,
138-
`app_setup=true; Path=/; HttpOnly; SameSite=Strict`,
137+
`session_token=${session.token}; Path=/; HttpOnly; SameSite=lax; Max-Age=${60 * 60 * 24 * 30}`,
138+
`app_setup=true; Path=/; HttpOnly; SameSite=lax`,
139139
])
140140

141141
await setRegistry(req.headers.host as string);

pages/api/user/account.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export async function handler(req: AuthenticatedRequest, res: NextApiResponse) {
5555
'session_token=',
5656
'Path=/',
5757
'HttpOnly',
58-
'SameSite=Strict',
58+
'SameSite=lax',
5959
'Secure',
6060
'Max-Age=0',
6161
].join('; '))

0 commit comments

Comments
 (0)