diff --git a/examples/guard-react/normal/package-lock.json b/examples/guard-react/normal/package-lock.json index cdb05bbd..cfa13252 100644 --- a/examples/guard-react/normal/package-lock.json +++ b/examples/guard-react/normal/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@authing/guard-react": "^5.1.9-alpha.2", + "@authing/guard-react": "^5.1.10", "face-api.js": "^0.22.2", "react": "^16.13.1", "react-dom": "^16.13.1", @@ -80,9 +80,9 @@ } }, "node_modules/@authing/guard": { - "version": "5.1.9-alpha.2", - "resolved": "https://registry.npmjs.org/@authing/guard/-/guard-5.1.9-alpha.2.tgz", - "integrity": "sha512-E1Gk6jY5RCMURe7v0g4W68zXqlJohd4fOXBOG13wh26b9QFkxORGSNQE/QqzFdGZjMfaY4WObVET9ibWBJhq4w==", + "version": "5.1.10", + "resolved": "https://registry.npmjs.org/@authing/guard/-/guard-5.1.10.tgz", + "integrity": "sha512-ho72ouzXAy5p2ewBps0u2SCcKxkBKZ8BED2Ws29Buzyq1FRqfOPd0C73AbEISBlq9mBWfNsurh9EguYv6tLOEg==", "dependencies": { "@authing/react-ui-components": "^4.3.16", "axios": "^0.27.2", @@ -91,11 +91,11 @@ } }, "node_modules/@authing/guard-react": { - "version": "5.1.9-alpha.2", - "resolved": "https://registry.npmjs.org/@authing/guard-react/-/guard-react-5.1.9-alpha.2.tgz", - "integrity": "sha512-Y6lQJ//x3ZyPmHVvROj+DlkrTVa7MN++hYNbz/EbxxFL07L9ccZrAU38w486puJ7oVOUUKayWAbyQuF3yBlw2A==", + "version": "5.1.10", + "resolved": "https://registry.npmjs.org/@authing/guard-react/-/guard-react-5.1.10.tgz", + "integrity": "sha512-UJlLmLYq2oBpoAeKReWcDNL1uMAIamWAYZ7lzXcnwF4hrEKcv0C3fxeaLk6JU9jn7QZJc+4NkjcMI83aWcBB2w==", "dependencies": { - "@authing/guard": "^5.1.9-alpha.2", + "@authing/guard": "^5.1.10", "react": "^16.13.1" } }, @@ -5858,9 +5858,9 @@ } }, "node_modules/rc-checkbox": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/rc-checkbox/-/rc-checkbox-3.0.0.tgz", - "integrity": "sha512-tOEs1+wWDUei7DuP2EsJCZfam5vxMjKTCGcZdXVgsiOcNszc41Esycbo31P0/jFwUAPmd5oPYFWkcnFUCTLZxA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/rc-checkbox/-/rc-checkbox-3.0.1.tgz", + "integrity": "sha512-k7nxDWxYF+jDI0ZcCvuvj71xONmWRVe5+1MKcERRR9MRyP3tZ69b+yUCSXXh+sik4/Hc9P5wHr2nnUoGS2zBjA==", "dependencies": { "@babel/runtime": "^7.10.1", "classnames": "^2.3.2", @@ -9447,9 +9447,9 @@ } }, "@authing/guard": { - "version": "5.1.9-alpha.2", - "resolved": "https://registry.npmjs.org/@authing/guard/-/guard-5.1.9-alpha.2.tgz", - "integrity": "sha512-E1Gk6jY5RCMURe7v0g4W68zXqlJohd4fOXBOG13wh26b9QFkxORGSNQE/QqzFdGZjMfaY4WObVET9ibWBJhq4w==", + "version": "5.1.10", + "resolved": "https://registry.npmjs.org/@authing/guard/-/guard-5.1.10.tgz", + "integrity": "sha512-ho72ouzXAy5p2ewBps0u2SCcKxkBKZ8BED2Ws29Buzyq1FRqfOPd0C73AbEISBlq9mBWfNsurh9EguYv6tLOEg==", "requires": { "@authing/react-ui-components": "^4.3.16", "axios": "^0.27.2", @@ -9458,11 +9458,11 @@ } }, "@authing/guard-react": { - "version": "5.1.9-alpha.2", - "resolved": "https://registry.npmjs.org/@authing/guard-react/-/guard-react-5.1.9-alpha.2.tgz", - "integrity": "sha512-Y6lQJ//x3ZyPmHVvROj+DlkrTVa7MN++hYNbz/EbxxFL07L9ccZrAU38w486puJ7oVOUUKayWAbyQuF3yBlw2A==", + "version": "5.1.10", + "resolved": "https://registry.npmjs.org/@authing/guard-react/-/guard-react-5.1.10.tgz", + "integrity": "sha512-UJlLmLYq2oBpoAeKReWcDNL1uMAIamWAYZ7lzXcnwF4hrEKcv0C3fxeaLk6JU9jn7QZJc+4NkjcMI83aWcBB2w==", "requires": { - "@authing/guard": "^5.1.9-alpha.2", + "@authing/guard": "^5.1.10", "react": "^16.13.1" } }, @@ -14190,9 +14190,9 @@ } }, "rc-checkbox": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/rc-checkbox/-/rc-checkbox-3.0.0.tgz", - "integrity": "sha512-tOEs1+wWDUei7DuP2EsJCZfam5vxMjKTCGcZdXVgsiOcNszc41Esycbo31P0/jFwUAPmd5oPYFWkcnFUCTLZxA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/rc-checkbox/-/rc-checkbox-3.0.1.tgz", + "integrity": "sha512-k7nxDWxYF+jDI0ZcCvuvj71xONmWRVe5+1MKcERRR9MRyP3tZ69b+yUCSXXh+sik4/Hc9P5wHr2nnUoGS2zBjA==", "requires": { "@babel/runtime": "^7.10.1", "classnames": "^2.3.2", diff --git a/examples/guard-react/normal/package.json b/examples/guard-react/normal/package.json index e162d3e1..ee13d13a 100644 --- a/examples/guard-react/normal/package.json +++ b/examples/guard-react/normal/package.json @@ -24,7 +24,7 @@ "webpack-merge": "^4.2.1" }, "dependencies": { - "@authing/guard-react": "^5.1.9-alpha.2", + "@authing/guard-react": "^5.1.10", "face-api.js": "^0.22.2", "react": "^16.13.1", "react-dom": "^16.13.1", diff --git a/examples/guard-react/normal/src/App.tsx b/examples/guard-react/normal/src/App.tsx index 0e9ab099..500e0042 100644 --- a/examples/guard-react/normal/src/App.tsx +++ b/examples/guard-react/normal/src/App.tsx @@ -16,7 +16,7 @@ export default function App() { appId="AUTHING_APP_ID" // 如果你使用的是私有化部署的 Authing 服务,需要传入自定义 host,如: - host="https://example.authing.cn" + // host="https://example.authing.cn" // 默认情况下,会使用你在 Authing 控制台中配置的第一个回调地址为此次认证使用的回调地址。 // 如果你配置了多个回调地址,也可以手动指定(此地址也需要加入到应用的「登录回调 URL」中): diff --git a/lerna.json b/lerna.json index 55c52068..03d4713a 100644 --- a/lerna.json +++ b/lerna.json @@ -4,5 +4,5 @@ "packages/*" ], "useWorkspaces": true, - "version": "5.1.9" + "version": "5.1.10" } diff --git a/packages/guard-angular/package-lock.json b/packages/guard-angular/package-lock.json index 721e158a..3e3b3b12 100644 --- a/packages/guard-angular/package-lock.json +++ b/packages/guard-angular/package-lock.json @@ -1,6 +1,6 @@ { "name": "@authing/guard-angular", - "version": "5.1.9", + "version": "5.1.10", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/guard-angular/package.json b/packages/guard-angular/package.json index 0af038d3..8a82b71d 100644 --- a/packages/guard-angular/package.json +++ b/packages/guard-angular/package.json @@ -1,6 +1,6 @@ { "name": "@authing/guard-angular", - "version": "5.1.9", + "version": "5.1.10", "description": "Guard for Angular", "module": "dist/fesm2015/authing-guard-angular.mjs", "types": "dist/index.d.ts", @@ -33,7 +33,7 @@ "@angular/core": "^14.0.0" }, "dependencies": { - "@authing/guard": "^5.1.9" + "@authing/guard": "^5.1.10" }, "author": "https://github.com/authing", "license": "MIT", diff --git a/packages/guard-react/package-lock.json b/packages/guard-react/package-lock.json index 21fb0d1a..5b6cad93 100644 --- a/packages/guard-react/package-lock.json +++ b/packages/guard-react/package-lock.json @@ -1,6 +1,6 @@ { "name": "@authing/guard-react", - "version": "5.1.9", + "version": "5.1.10", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/guard-react/package.json b/packages/guard-react/package.json index 5d97b415..503358a4 100644 --- a/packages/guard-react/package.json +++ b/packages/guard-react/package.json @@ -1,6 +1,6 @@ { "name": "@authing/guard-react", - "version": "5.1.9", + "version": "5.1.10", "description": "Guard for React", "module": "dist/esm/guard.min.js", "types": "dist/typings/index.d.ts", @@ -24,7 +24,7 @@ "webpack": "^5.72.0" }, "dependencies": { - "@authing/guard": "^5.1.9", + "@authing/guard": "^5.1.10", "react": "^16.13.1" }, "author": "https://github.com/authing", diff --git a/packages/guard-react18/package-lock.json b/packages/guard-react18/package-lock.json index 5d496977..09d2f7d6 100644 --- a/packages/guard-react18/package-lock.json +++ b/packages/guard-react18/package-lock.json @@ -1,6 +1,6 @@ { "name": "@authing/guard-react18", - "version": "5.1.9", + "version": "5.1.10", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/guard-react18/package.json b/packages/guard-react18/package.json index b8fd10ef..f1995d2d 100644 --- a/packages/guard-react18/package.json +++ b/packages/guard-react18/package.json @@ -1,6 +1,6 @@ { "name": "@authing/guard-react18", - "version": "5.1.9", + "version": "5.1.10", "description": "Guard for React18", "module": "dist/esm/guard.min.js", "types": "dist/typings/index.d.ts", @@ -25,7 +25,7 @@ "webpack": "^5.72.0" }, "dependencies": { - "@authing/guard-shim-react18": "^5.1.9", + "@authing/guard-shim-react18": "^5.1.10", "react": "^18.0.0" }, "author": "https://github.com/authing", diff --git a/packages/guard-shim-react18/package-lock.json b/packages/guard-shim-react18/package-lock.json index bff18d9b..c4fe9e25 100644 --- a/packages/guard-shim-react18/package-lock.json +++ b/packages/guard-shim-react18/package-lock.json @@ -1,6 +1,6 @@ { "name": "@authing/guard-shim-react18", - "version": "5.1.9", + "version": "5.1.10", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/guard-shim-react18/package.json b/packages/guard-shim-react18/package.json index 83540a2b..6663ce61 100644 --- a/packages/guard-shim-react18/package.json +++ b/packages/guard-shim-react18/package.json @@ -1,6 +1,6 @@ { "name": "@authing/guard-shim-react18", - "version": "5.1.9", + "version": "5.1.10", "description": "Guard shim for react18", "module": "dist/esm/guard.min.js", "types": "dist/typings/index.d.ts", diff --git a/packages/guard-vue2/package-lock.json b/packages/guard-vue2/package-lock.json index d1a2ff10..b92a0bce 100644 --- a/packages/guard-vue2/package-lock.json +++ b/packages/guard-vue2/package-lock.json @@ -1,6 +1,6 @@ { "name": "@authing/guard-vue2", - "version": "5.1.9", + "version": "5.1.10", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/guard-vue2/package.json b/packages/guard-vue2/package.json index 8c4ba269..98f73870 100644 --- a/packages/guard-vue2/package.json +++ b/packages/guard-vue2/package.json @@ -1,6 +1,6 @@ { "name": "@authing/guard-vue2", - "version": "5.1.9", + "version": "5.1.10", "description": "Guard for Vue2", "module": "dist/esm/guard.min.js", "types": "dist/typings/index.d.ts", @@ -23,7 +23,7 @@ "webpack": "^5.72.0" }, "dependencies": { - "@authing/guard": "^5.1.9", + "@authing/guard": "^5.1.10", "vue": "^2.6.10" }, "author": "https://github.com/authing", diff --git a/packages/guard-vue3/package-lock.json b/packages/guard-vue3/package-lock.json index 0e3158f5..ff084a19 100644 --- a/packages/guard-vue3/package-lock.json +++ b/packages/guard-vue3/package-lock.json @@ -1,6 +1,6 @@ { "name": "@authing/guard-vue3", - "version": "5.1.9", + "version": "5.1.10", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/guard-vue3/package.json b/packages/guard-vue3/package.json index f3c0bba5..1689ed79 100644 --- a/packages/guard-vue3/package.json +++ b/packages/guard-vue3/package.json @@ -1,6 +1,6 @@ { "name": "@authing/guard-vue3", - "version": "5.1.9", + "version": "5.1.10", "description": "Guard for Vue3", "module": "dist/esm/guard.min.js", "types": "dist/typings/index.d.ts", @@ -24,7 +24,7 @@ "webpack": "^5.72.0" }, "dependencies": { - "@authing/guard": "^5.1.9", + "@authing/guard": "^5.1.10", "vue": "^3.2.37" }, "author": "https://github.com/authing", diff --git a/packages/guard/package-lock.json b/packages/guard/package-lock.json index 3e6680fc..580ef003 100644 --- a/packages/guard/package-lock.json +++ b/packages/guard/package-lock.json @@ -1,6 +1,6 @@ { "name": "@authing/guard", - "version": "5.1.9", + "version": "5.1.10", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/packages/guard/package.json b/packages/guard/package.json index 9e78ccef..215594df 100644 --- a/packages/guard/package.json +++ b/packages/guard/package.json @@ -1,6 +1,6 @@ { "name": "@authing/guard", - "version": "5.1.9", + "version": "5.1.10", "description": "Guard for JS", "module": "dist/esm/guard.min.js", "types": "dist/typings/index.d.ts", diff --git a/packages/guard/src/index.tsx b/packages/guard/src/index.tsx index 169c872b..3947be39 100644 --- a/packages/guard/src/index.tsx +++ b/packages/guard/src/index.tsx @@ -252,10 +252,34 @@ export class Guard { return } - const loginStatus: JwtTokenStatus = await authClient.checkLoginStatus(token) + const host = `${this.options.host}` || 'https://core.authing.cn' + + const options: RequestInit = { + method: 'POST', + credentials: 'include', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + token + }) + } + + try { + const fetchRes = await fetch( + `${host}/api/v2/users/login/check-status`, + options + ) + + const loginStatusText = await fetchRes.text() + + const loginStatus: JwtTokenStatus = JSON.parse(loginStatusText) - if (loginStatus.status) { - return loginStatus + if (loginStatus.code === 200 && loginStatus.status === true) { + return loginStatus + } + } catch (e) { + return } }