Skip to content

Commit

Permalink
i18n(ko-KR): update google-firebase.mdx (withastro#8140)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsparkdev authored and wpplumber committed May 4, 2024
1 parent 15a5f11 commit d7a2e59
Showing 1 changed file with 12 additions and 8 deletions.
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

0 comments on commit d7a2e59

Please sign in to comment.