Skip to content

Commit e3eda27

Browse files
i18n(ko-KR): update authentication.mdx (withastro#12535)
Co-authored-by: Yan <[email protected]>
1 parent e69f2fd commit e3eda27

File tree

1 file changed

+1
-135
lines changed

1 file changed

+1
-135
lines changed

src/content/docs/ko/guides/authentication.mdx

Lines changed: 1 addition & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -11,148 +11,14 @@ import ReadMore from '~/components/ReadMore.astro'
1111

1212
인증 및 승인은 웹사이트 또는 앱에 대한 액세스를 관리하는 두 가지 보안 프로세스입니다. 인증은 방문자의 신원을 확인하는 반면, 승인은 보호 구역 및 자원에 대한 접근 권한을 부여합니다.
1313

14-
인증을 사용하면 사이트의 특정 영역을 로그인한 개인에 맞춰 사용자 정의할 수 있으며 개인 정보 또는 비공개 정보를 최대한 보호할 수 있습니다. 인증 라이브러리 (예: [Auth.js](https://authjs.dev/), [Clerk](https://clerk.com))는 이메일 로그인 및 OAuth 공급자와 같은 다양한 인증 방법을 위한 유틸리티를 제공합니다.
14+
인증을 사용하면 사이트의 특정 영역을 로그인한 개인에 맞춰 사용자 정의할 수 있으며 개인 정보 또는 비공개 정보를 최대한 보호할 수 있습니다. 인증 라이브러리 (예: [Better Auth](https://better-auth.com/), [Clerk](https://clerk.com))는 이메일 로그인 및 OAuth 공급자와 같은 다양한 인증 방법을 위한 유틸리티를 제공합니다.
1515

1616
:::tip
1717
Astro에 대한 공식 인증 솔루션은 없지만 통합 디렉터리에서 [커뮤니티 "인증" 통합](https://astro.build/integrations/?search=auth)을 찾을 수 있습니다.
1818
:::
1919

2020
<ReadMore>이러한 백엔드 서비스에 대한 전용 가이드에서 [Supabase로 인증을 추가](/ko/guides/backend/supabase/#supabase로-인증-추가)하거나 [Firebase로 인증을 추가](/ko/guides/backend/google-firebase/#firebase로-인증-추가)하는 방법을 알아보세요.</ReadMore>
2121

22-
## Auth.js
23-
24-
Auth.js는 프레임워크에 구애받지 않는 인증 솔루션입니다. Astro용 커뮤니티 프레임워크 어댑터 [`auth-astro`](https://www.npmjs.com/package/auth-astro)를 사용할 수 있습니다.
25-
26-
### 설치
27-
28-
선호하는 패키지 관리자의 `astro add` 명령어를 사용하여, 요청 시 렌더링을 위한 [서버 어댑터](/ko/guides/on-demand-rendering/#서버-어댑터)가 구성된 Astro 프로젝트에 `auth-astro` 통합을 추가하세요.
29-
30-
<PackageManagerTabs>
31-
<Fragment slot="npm">
32-
```shell
33-
npx astro add auth-astro
34-
```
35-
</Fragment>
36-
<Fragment slot="pnpm">
37-
```shell
38-
pnpm astro add auth-astro
39-
```
40-
</Fragment>
41-
<Fragment slot="yarn">
42-
```shell
43-
yarn astro add auth-astro
44-
```
45-
</Fragment>
46-
</PackageManagerTabs>
47-
48-
#### 수동 설치
49-
50-
`auth-astro`를 수동으로 설치하려면 패키지 관리자로 필요한 패키지를 설치하세요.
51-
52-
<PackageManagerTabs>
53-
<Fragment slot="npm">
54-
```shell
55-
npm install auth-astro @auth/core@^0.18.6
56-
```
57-
</Fragment>
58-
<Fragment slot="pnpm">
59-
```shell
60-
pnpm add auth-astro @auth/core@^0.18.6
61-
```
62-
</Fragment>
63-
<Fragment slot="yarn">
64-
```shell
65-
yarn add auth-astro @auth/core@^0.18.6
66-
```
67-
</Fragment>
68-
</PackageManagerTabs>
69-
70-
그런 다음 `integrations` 속성을 사용하여 `astro.config.*` 파일에 통합을 적용합니다.
71-
72-
```ts title="astro.config.mjs" ins={3,8}
73-
import { defineConfig } from 'astro/config';
74-
import netlify from '@astrojs/netlify';
75-
import auth from 'auth-astro';
76-
77-
export default defineConfig({
78-
// ...
79-
adapter: netlify(),
80-
integrations: [auth()],
81-
});
82-
```
83-
84-
### 구성
85-
86-
프로젝트의 루트 디렉터리에 `auth.config.ts` 파일을 생성합니다. 필요한 환경 변수와 함께 지원하려는 인증 [공급자](https://authjs.dev/getting-started/providers) 또는 메서드를 추가하세요.
87-
88-
```ts title="auth.config.ts"
89-
import GitHub from '@auth/core/providers/github';
90-
import { defineConfig } from 'auth-astro';
91-
92-
export default defineConfig({
93-
providers: [
94-
GitHub({
95-
clientId: import.meta.env.GITHUB_CLIENT_ID,
96-
clientSecret: import.meta.env.GITHUB_CLIENT_SECRET,
97-
}),
98-
],
99-
});
100-
```
101-
102-
아직 존재하지 않는 경우 프로젝트 루트에 `.env` 파일을 생성합니다. 다음 두 가지 환경 변수를 추가합니다. `AUTH_SECRET`은 최소 32자의 비공개 문자열이어야 합니다.
103-
104-
```sh title=".env"
105-
AUTH_TRUST_HOST=true
106-
AUTH_SECRET=<my-auth-secret>
107-
```
108-
109-
### 사용
110-
111-
script 태그 또는 클라이언트 측 프레임워크 컴포넌트에서 `auth-astro/client` 모듈을 사용하여 로그인 및 로그아웃 버튼을 추가할 수 있습니다.
112-
113-
```astro title="src/pages/index.astro" {9}
114-
---
115-
import Layout from 'src/layouts/Base.astro';
116-
---
117-
<Layout>
118-
<button id="login">Login</button>
119-
<button id="logout">Logout</button>
120-
121-
<script>
122-
const { signIn, signOut } = await import("auth-astro/client")
123-
document.querySelector("#login").onclick = () => signIn("github")
124-
document.querySelector("#logout").onclick = () => signOut()
125-
</script>
126-
</Layout>
127-
```
128-
129-
`getSession` 메서드를 사용하여 사용자 세션을 가져올 수 있습니다.
130-
131-
```astro title="src/pages/index.astro" {3,7}
132-
---
133-
import Layout from 'src/layouts/Base.astro';
134-
import { getSession } from 'auth-astro/server';
135-
136-
export const prerender = false; // 'server' 모드에서는 필요하지 않습니다.
137-
138-
const session = await getSession(Astro.request);
139-
---
140-
<Layout>
141-
{
142-
session ? (
143-
<p>Welcome {session.user?.name}</p>
144-
) : (
145-
<p>Not logged in</p>
146-
)
147-
}
148-
</Layout>
149-
```
150-
151-
### 다음 단계
152-
153-
- [`auth-astro` GitHub](https://github.com/nowaythatworked/auth-astro?tab=readme-ov-file#auth-astro)
154-
- [Auth.js 문서](https://authjs.dev/)
155-
15622
## Better Auth
15723

15824
Better Auth는 프레임워크에 구애받지 않는 TypeScript용 인증 (및 권한 부여) 프레임워크입니다. 기본적으로 포괄적인 기능 세트를 제공하며 고급 기능을 간편하게 추가할 수 있는 플러그인 생태계가 포함되어 있습니다.

0 commit comments

Comments
 (0)