Skip to content

Commit 285281d

Browse files
Merge pull request #236 from Authing/fix-doc-v5-20230710
fix(doc): update demo links, and so on
2 parents 3dd4f6c + abe3488 commit 285281d

3 files changed

Lines changed: 41 additions & 45 deletions

File tree

docs/guide/essentials/events.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88

99
```tsx
1010
// React 16 / 17
11-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react/normal/src/pages/Embed.tsx
11+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react/normal/src/pages/Embed.tsx
1212
import { useGuard, User } from "@authing/guard-react";
1313

1414
// React 18
15-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react18/normal/src/pages/Embed.tsx
15+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react18/normal/src/pages/Embed.tsx
1616
// import { useGuard, User } from "@authing/guard-react18";
1717

1818
import React, { useEffect } from "react";
@@ -46,7 +46,7 @@ export default function Login() {
4646
::: tab Vue2
4747

4848
```javascript
49-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue2/normal/src/views/Embed.vue
49+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue2/normal/src/views/Embed.vue
5050
export default {
5151
mounted() {
5252
// 使用 start 方法挂载 Guard 组件到你指定的 DOM 节点,登录成功后返回 userInfo
@@ -69,7 +69,7 @@ export default {
6969

7070
```html
7171
<script lang="ts" setup>
72-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue3/normal/src/views/Embed.vue
72+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue3/normal/src/views/Embed.vue
7373
import { onMounted } from "vue";
7474
7575
import { useGuard } from "@authing/guard-vue3";
@@ -98,7 +98,7 @@ export default {
9898
::: tab Angular
9999

100100
```typescript
101-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-angular/normal/src/app/pages/embed/embed.component.ts
101+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-angular/normal/src/app/pages/embed/embed.component.ts
102102
import { Component, ChangeDetectorRef } from "@angular/core";
103103

104104
import { GuardService, User } from "@authing/guard-angular";
@@ -132,7 +132,7 @@ export class EmbedComponent {
132132

133133
::: tab CDN
134134
```javascript
135-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard/normal/embed.html
135+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard/normal/embed.html
136136
guard.on("login", (userInfo) => {
137137
// 自定义登录成功后的业务逻辑
138138
// 比如跳转到对应的某个页面等

docs/guide/essentials/mode.md

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717

1818
## 使用托管模式
1919

20-
::: hint-info
21-
使用托管模式会涉及到路由跳转,Safari、Firefox 等浏览器默认开启『阻止跨站跟踪』,导致 Cookie 无法有效传输,推荐使用 Chrome 浏览器。目前已有解决方案,我们接下来会修复这个问题。
22-
:::
23-
2420
托管模式将跳转到 Authing 提供的托管登录页。由于此模式 Authing 默认使用 OIDC 标准协议认证,你需要进行以下额外配置:
2521

2622
-[Authing 控制台](https://console.authing.cn) 的 <strong>应用 -> 自建应用 -> 应用详情</strong> 中配置 <strong>登录回调 URL</strong>,回调地址为下述示例代码中 Callback 页面地址,此处以 `http://localhost:3000/callback` 为例:
@@ -49,11 +45,11 @@
4945
// Jump.tsx
5046

5147
// React16 / 17
52-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react/normal/src/pages/Jump.tsx
48+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react/normal/src/pages/Jump.tsx
5349
import { useGuard } from "@authing/guard-react";
5450

5551
// React 18
56-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react18/normal/src/pages/Jump.tsx
52+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react18/normal/src/pages/Jump.tsx
5753
// import { useGuard } from '@authing/guard-react18';
5854

5955
export default function Jump() {
@@ -78,11 +74,11 @@ export default function Jump() {
7874
// Callback.tsx
7975

8076
// React 16 / 17
81-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react/normal/src/pages/Callback.tsx
77+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react/normal/src/pages/Callback.tsx
8278
import { JwtTokenStatus, useGuard, User } from '@authing/guard-react';
8379

8480
// React 18
85-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react18/normal/src/pages/Callback.tsx
81+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react18/normal/src/pages/Callback.tsx
8682
// import { JwtTokenStatus, useGuard, User } from '@authing/guard-react18';
8783

8884
import React, { useEffect } from 'react';
@@ -138,11 +134,11 @@ export default function Callback() {
138134
// Personal.tsx
139135

140136
// React 16 / 17
141-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react/normal/src/pages/Personal.tsx
137+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react/normal/src/pages/Personal.tsx
142138
import { useGuard, User } from '@authing/guard-react';
143139

144140
// React 18
145-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react18/normal/src/pages/Personal.tsx
141+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react18/normal/src/pages/Personal.tsx
146142
// import { useGuard, User } from '@authing/guard-react18';
147143

148144
import React, { useEffect, useState } from 'react';
@@ -175,7 +171,7 @@ export default function Personal() {
175171
::: tab Vue2
176172

177173
```javascript
178-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue2/normal/src/views/Jump.vue
174+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue2/normal/src/views/Jump.vue
179175
// Jump.vue
180176
export default {
181177
methods: {
@@ -188,7 +184,7 @@ export default {
188184
```
189185

190186
``` javascript
191-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue2/normal/src/views/Callback.vue
187+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue2/normal/src/views/Callback.vue
192188
// Callback.vue
193189
export default {
194190
data () {
@@ -238,7 +234,7 @@ export default {
238234
``` html
239235
<template>
240236
<div class="personal-container">
241-
<!-- 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue2/normal/src/views/Personal.vue -->
237+
<!-- 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue2/normal/src/views/Personal.vue -->
242238
<!-- Personal.vue -->
243239
<textarea id="" cols="100" rows="30" :value="userInfo"></textarea>
244240
</div>
@@ -269,7 +265,7 @@ export default {
269265
::: tab Vue3
270266

271267
```javascript
272-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue3/normal/src/views/Jump.vue
268+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue3/normal/src/views/Jump.vue
273269
// Jump.vue
274270
import { useGuard } from "@authing/guard-vue3";
275271

@@ -284,7 +280,7 @@ const startWithRedirect = () => {
284280
``` html
285281
<template>
286282
<div class="personal-container">
287-
<!-- 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue3/normal/src/views/Callback.vue -->
283+
<!-- 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue3/normal/src/views/Callback.vue -->
288284
<!-- Callback.vue -->
289285
<textarea id="" cols="100" rows="30" :value="userInfo"></textarea>
290286
</div>
@@ -346,7 +342,7 @@ onMounted(() => {
346342
``` html
347343
<template>
348344
<div class="personal-container">
349-
<!-- 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue3/normal/src/views/Personal.vue -->
345+
<!-- 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue3/normal/src/views/Personal.vue -->
350346
<!-- Personal.vue -->
351347
<textarea id="" cols="100" rows="30" :value="userInfo"></textarea>
352348
</div>
@@ -378,7 +374,7 @@ onMounted(() => {
378374
::: tab Angular
379375

380376
```typescript
381-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-angular/normal/src/app/pages/jump/jump.component.ts
377+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-angular/normal/src/app/pages/jump/jump.component.ts
382378
// jump.component.ts
383379
// Angular 组件中使用 Guard API
384380
import { Component } from "@angular/core";
@@ -403,7 +399,7 @@ export class HomeComponent {
403399
```
404400

405401
``` typescript
406-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-angular/normal/src/app/pages/callback/callback.component.ts
402+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-angular/normal/src/app/pages/callback/callback.component.ts
407403
// callback.component.ts
408404
import { Component } from '@angular/core'
409405
import { Router } from '@angular/router'
@@ -464,7 +460,7 @@ export class CallbackComponent {
464460
```
465461

466462
``` typescript
467-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-angular/normal/src/app/pages/personal/personal.component.ts
463+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-angular/normal/src/app/pages/personal/personal.component.ts
468464
// personal.component.ts
469465
import { Component } from '@angular/core'
470466

@@ -496,7 +492,7 @@ export class PersonalComponent {
496492
::: tab CDN
497493

498494
```javascript
499-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard/normal/jump.html
495+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard/normal/jump.html
500496
// jump.html
501497
const guard = new GuardFactory.Guard({
502498
// 你可以前往 Authing 控制台的本应用详情页查看你的 App ID
@@ -517,7 +513,7 @@ function startWithRedirect() {
517513
```
518514

519515
``` javascript
520-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard/normal/callback.html
516+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard/normal/callback.html
521517
// callback.html
522518
const guard = new GuardFactory.Guard(guardOptions)
523519

@@ -572,7 +568,7 @@ async function handleAuthingLoginCallback () {
572568
<link rel="stylesheet" href="https://cdn.authing.co/packages/guard/latest/guard.min.css" />
573569
</head>
574570
<body>
575-
<!-- 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard/normal/personal.html -->
571+
<!-- 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard/normal/personal.html -->
576572
<!-- personal.html -->
577573
<button onclick="getUserInfo()">Get User Info</button>
578574

@@ -600,11 +596,11 @@ async function handleAuthingLoginCallback () {
600596

601597
```tsx
602598
// React 16 / 17
603-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react/normal/src/pages/Embed.tsx
599+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react/normal/src/pages/Embed.tsx
604600
import { useGuard, User } from "@authing/guard-react";
605601

606602
// React 18
607-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react18/normal/src/pages/Embed.tsx
603+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react18/normal/src/pages/Embed.tsx
608604
// import { useGuard, User } from "@authing/guard-react18";
609605

610606
import React, { useEffect } from "react";
@@ -634,7 +630,7 @@ export default function Login() {
634630

635631
```vue
636632
<template>
637-
<!-- 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue2/normal/src/views/Embed.vue -->
633+
<!-- 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue2/normal/src/views/Embed.vue -->
638634
<div id="authing-guard-container"></div>
639635
</template>
640636
<script>
@@ -655,7 +651,7 @@ export default {
655651

656652
```vue
657653
<template>
658-
<!-- 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue3/normal/src/views/Embed.vue -->
654+
<!-- 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue3/normal/src/views/Embed.vue -->
659655
<div id="authing-guard-container"></div>
660656
</template>
661657
@@ -680,7 +676,7 @@ onMounted(() => {
680676
::: tab Angular
681677

682678
```typescript
683-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-angular/normal/src/app/pages/embed/embed.component.ts
679+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-angular/normal/src/app/pages/embed/embed.component.ts
684680
import { Component } from "@angular/core";
685681
import { GuardService, User } from "@authing/guard-angular";
686682

@@ -750,12 +746,12 @@ guard.start("#authing-guard-container").then((userInfo) => {
750746
// App.tsx
751747

752748
// React 16 / 17
753-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react/modal/src/App.tsx
749+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react/modal/src/App.tsx
754750
import { GuardProvider } from "@authing/guard-react";
755751
import "@authing/guard-react/dist/esm/guard.min.css";
756752

757753
// React 18
758-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react18/modal/src/App.tsx
754+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react18/modal/src/App.tsx
759755
// import { GuardProvider } from "@authing/guard-react18";
760756
// import "@authing/guard-react18/dist/esm/guard.min.css";
761757

@@ -784,11 +780,11 @@ function App() {
784780
// Embed.tsx
785781

786782
// React 16 / 17
787-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react/modal/src/pages/Embed.tsx
783+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react/modal/src/pages/Embed.tsx
788784
import { useGuard, User } from "@authing/guard-react";
789785

790786
// React 18
791-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-react18/modal/src/pages/Embed.tsx
787+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-react18/modal/src/pages/Embed.tsx
792788
// import { useGuard, User } from "@authing/guard-react18";
793789

794790
export default function Embed() {
@@ -829,7 +825,7 @@ export default function Embed() {
829825
::: tab Vue2
830826

831827
```javascript
832-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue2/modal/src/main.js
828+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue2/modal/src/main.js
833829
// main.js
834830
import Vue from "vue";
835831
import { GuardPlugin } from "@authing/guard-vue2";
@@ -849,7 +845,7 @@ Vue.use(GuardPlugin, {
849845

850846
```html
851847
<template>
852-
<!-- 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue2/modal/src/views/Embed.vue -->
848+
<!-- 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue2/modal/src/views/Embed.vue -->
853849
<!-- Embed.vue -->
854850
<div class="embed-container">
855851
<button class="authing-button" @click="showGuard">Show Guard</button>
@@ -889,7 +885,7 @@ Vue.use(GuardPlugin, {
889885
::: tab Vue3
890886

891887
```javascript
892-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue3/modal/src/main.ts
888+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue3/modal/src/main.ts
893889
// main.ts
894890
import { createApp } from "vue";
895891
import App from "./App.vue";
@@ -914,7 +910,7 @@ app.use(
914910

915911
```html
916912
<template>
917-
<!-- 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-vue3/modal/src/views/Embed.vue -->
913+
<!-- 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-vue3/modal/src/views/Embed.vue -->
918914
<!-- Embed.vue -->
919915
<div class="embed-container">
920916
<button class="authing-button" @click="showGuard">Show Guard</button>
@@ -955,7 +951,7 @@ app.use(
955951
::: tab Angular
956952

957953
```typescript
958-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-angular/modal/src/app/app.module.ts
954+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-angular/modal/src/app/app.module.ts
959955
// app.module.ts
960956
import { NgModule } from "@angular/core";
961957
import { BrowserModule } from "@angular/platform-browser";
@@ -985,7 +981,7 @@ export class AppModule {}
985981
```
986982

987983
```typescript
988-
// 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard-angular/modal/src/app/pages/embed/embed.component.ts
984+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-angular/modal/src/app/pages/embed/embed.component.ts
989985
// embed.component.ts
990986
import { Component } from "@angular/core";
991987

@@ -1022,7 +1018,7 @@ export class EmbedComponent {
10221018
::: tab CDN
10231019

10241020
```html
1025-
<!-- 代码示例:https://github.com/Authing/Guard/blob/master/examples/guard/modal/embed.html -->
1021+
<!-- 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard/modal/embed.html -->
10261022
<button onclick="showGuard()">Show Guard</button>
10271023

10281024
<div>

docs/guide/quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ onMounted(() => {
253253
```
254254

255255
```typescript
256-
// 代码示例:https://github.com/Authing/Guard/blob/v5/examples/guard-angular/normal/src/app/pages/embed/embed.component.ts
256+
// 代码示例:https://github.com/Authing/Guard/tree/v5/examples/guard-angular/normal/src/app/pages/embed/embed.component.ts
257257
import { Component } from '@angular/core'
258258

259259
import { GuardService, User } from '@authing/guard-angular'

0 commit comments

Comments
 (0)