Skip to content

Commit

Permalink
feat: ✨ update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
willin committed Dec 12, 2023
1 parent d565f53 commit 6b6fa16
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
26 changes: 22 additions & 4 deletions apps/web/src/routes/(zh)/auth/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ export const handle = handleAuth({

就是这样。

## 高级使用
## 进阶使用

如果您没有设置`authRouting`。 您需要添加一个登录处理程序`src/routes/auth/[provider]/+server.ts`
### 自定义路由

如果您没有设置`authRouting`,您首先需要添加一个 `src/routes/auth/[provider]/+server.ts`:

```ts
import { redirect, type RequestEvent } from '@sveltejs/kit';
Expand All @@ -119,10 +121,10 @@ export const GET = async (event: RequestEvent) => {
};
```

然后,添加一个回调处理程序`src/routes/auth/[provider]/callback/+server.ts.ts`
然后添加回调 `src/routes/auth/[provider]/callback/+server.ts.ts:`

```ts
// same as before...
// 根据实际需要修改
import type { RequestEvent } from '@sveltejs/kit';

export const GET = async (event: RequestEvent) => {
Expand Down Expand Up @@ -172,6 +174,22 @@ declare global {
export {};
```

### 策略

目前已经支持的策略有:

| Package | Meta | Changelog |
| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| [@svelte-dev/auth-oauth2](packages/auth-oauth2/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-oauth2?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-oauth2) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-oauth2?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-oauth2) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-oauth2?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-oauth2) | [Changelog](packages/auth-oauth2/CHANGELOG.md) |
| [@svelte-dev/auth-github](packages/auth-github/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-github?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-github) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-github?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-github) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-github?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-github) | [Changelog](packages/auth-github/CHANGELOG.md) |
| [@svelte-dev/auth-alipay](packages/auth-alipay/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-alipay?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-alipay) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-alipay?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-alipay) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-alipay?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-alipay) | [Changelog](packages/auth-alipay/CHANGELOG.md) |
| [@svelte-dev/auth-afdian](packages/auth-afdian/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-afdian?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-afdian) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-afdian?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-afdian) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-afdian?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-afdian) | [Changelog](packages/auth-afdian/CHANGELOG.md) |
| [@svelte-dev/auth-sso](packages/auth-sso/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-sso?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-sso) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-sso?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-sso) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-sso?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-sso) | [Changelog](packages/auth-sso/CHANGELOG.md) |

注意: 不同的策略配置参数可能不尽相同。

> 欢迎共享您的策略。
## TypeDocs

[自动化生成的接口文档](/docs/auth/)
Expand Down
14 changes: 14 additions & 0 deletions apps/web/src/routes/en/auth/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ That's it.

## Advanced Usage

### Custom Handle

If you did not set `authRouting`. You need to add a login handler `src/routes/auth/[provider]/+server.ts`:

```ts
Expand Down Expand Up @@ -171,6 +173,18 @@ declare global {
export {};
```

### Strategies

| Package | Meta | Changelog |
| ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| [@svelte-dev/auth-oauth2](packages/auth-oauth2/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-oauth2?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-oauth2) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-oauth2?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-oauth2) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-oauth2?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-oauth2) | [Changelog](packages/auth-oauth2/CHANGELOG.md) |
| [@svelte-dev/auth-github](packages/auth-github/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-github?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-github) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-github?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-github) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-github?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-github) | [Changelog](packages/auth-github/CHANGELOG.md) |
| [@svelte-dev/auth-alipay](packages/auth-alipay/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-alipay?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-alipay) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-alipay?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-alipay) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-alipay?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-alipay) | [Changelog](packages/auth-alipay/CHANGELOG.md) |
| [@svelte-dev/auth-afdian](packages/auth-afdian/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-afdian?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-afdian) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-afdian?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-afdian) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-afdian?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-afdian) | [Changelog](packages/auth-afdian/CHANGELOG.md) |
| [@svelte-dev/auth-sso](packages/auth-sso/) | [![npm](https://img.shields.io/npm/v/@svelte-dev/auth-sso?style=flat-square&logo=npm)](https://npmjs.org/package/@svelte-dev/auth-sso) [![npm](https://img.shields.io/npm/dm/@svelte-dev/auth-sso?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-sso) [![npm](https://img.shields.io/npm/dt/@svelte-dev/auth-sso?style=flat-square&label=down)](https://npmjs.org/package/@svelte-dev/auth-sso) | [Changelog](packages/auth-sso/CHANGELOG.md) |

> Welcome to share your strategies here.
## TypeDocs

[API Spec](/docs/auth/)
Expand Down

0 comments on commit 6b6fa16

Please sign in to comment.