Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n(ko-KR): update google-firebase.mdx #8140

Merged
merged 1 commit into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/content/docs/ko/guides/backend/google-firebase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,18 @@ export const GET: APIRoute = async ({ request, cookies, redirect }) => {
expiresIn: fiveDays,
});

cookies.set("session", sessionCookie, {
cookies.set("__session", sessionCookie, {
path: "/",
});

return redirect("/dashboard");
};
```

:::caution
Firebase에서는 [쿠키 1개만 사용할 수 있으며 이름은 `__session`으로 지정해야 합니다](https://firebase.google.com/docs/hosting/manage-cache#using_cookies). 클라이언트가 보내는 다른 쿠키는 애플리케이션에 표시되지 않습니다.
:::

:::note
이는 로그인 엔드포인트의 기본 구현입니다. 필요에 따라 이 엔드포인트에 논리를 더 추가할 수 있습니다.
:::
Expand All @@ -237,7 +241,7 @@ export const GET: APIRoute = async ({ request, cookies, redirect }) => {
import type { APIRoute } from "astro";

export const GET: APIRoute = async ({ redirect, cookies }) => {
cookies.delete("session", {
cookies.delete("__session", {
path: "/",
});
return redirect("/signin");
Expand Down Expand Up @@ -355,8 +359,8 @@ import Layout from "../layouts/Layout.astro";

/* 사용자가 인증되었는지 확인 */
const auth = getAuth(app);
if (Astro.cookies.has("session")) {
const sessionCookie = Astro.cookies.get("session").value;
if (Astro.cookies.has("__session")) {
const sessionCookie = Astro.cookies.get("__session").value;
const decodedCookie = await auth.verifySessionCookie(sessionCookie);
if (decodedCookie) {
return Astro.redirect("/dashboard");
Expand Down Expand Up @@ -432,10 +436,10 @@ import Layout from "../layouts/Layout.astro";
const auth = getAuth(app);

/* 현재 세션 확인 */
if (!Astro.cookies.has("session")) {
if (!Astro.cookies.has("__session")) {
return Astro.redirect("/signin");
}
const sessionCookie = Astro.cookies.get("session").value;
const sessionCookie = Astro.cookies.get("__session").value;
const decodedCookie = await auth.verifySessionCookie(sessionCookie);
const user = await auth.getUser(decodedCookie.uid);

Expand Down Expand Up @@ -473,8 +477,8 @@ import Layout from "../layouts/Layout.astro";

/* 사용자가 인증되었는지 확인 */
const auth = getAuth(app);
if (Astro.cookies.has("session")) {
const sessionCookie = Astro.cookies.get("session").value;
if (Astro.cookies.has("__session")) {
const sessionCookie = Astro.cookies.get("__session").value;
const decodedCookie = await auth.verifySessionCookie(sessionCookie);
if (decodedCookie) {
return Astro.redirect("/dashboard");
Expand Down
Loading