authing / authing-js-sdk Goto Github PK
View Code? Open in Web Editor NEW๐ฅ Authing SDK for JavaScript, Miniprogram
License: MIT License
๐ฅ Authing SDK for JavaScript, Miniprogram
License: MIT License
The documentation of Authing Pipeline can be found here.
.
Messageๆ็ๆถๅๆฏstructure๏ผๆ็ๆถๅๆฏstring๏ผ่ง่ๆ ผๅผๆฏ่พ็ปไธ็่ฏไผๆดๅฎนๆ่งฃๆใ
ไธ้ข่ฟๅ็ไพๅญ้messageๅฐฑๆฏstring๏ผไฝๆฏๅคงๅคๆฐๆ ๅตไธ้ฝๆฏstructure
{
"data":{
"removeUsers":null
},
"errors":[
{
"message":"Cast to ObjectId failed for value \"111\" at path \"_id\" for model \"User\"",
"name":"CastError",
"stringValue":"\"111\"",
"kind":"ObjectId",
"value":"111",
"path":"_id"
}
]
}
่ฟไธชๆไบค ไธญ็ๅฆไธไปฃ็ ๆฏๆ้ฎ้ข็๏ผ
ๅฏ้่ฟ็ฎ็ฌฆ navigator?.userAgent
ๅฏ็จ็ๅๆๆฏ navigator
ๅ้ๅทฒ็ป่ขซๅฎไนไบ๏ผๅฆๆ navigator
ๆฒกๅฎไน๏ผๆง่ก่ฟ่กไปฃ็ ๆถไป็ถไผ ReferenceError ้่ฏฏ๏ผๅ ไธบๅฏๅ
่ฟ็ฎ็ฌฆ็ ็ญๆ js ไปฃ็ ๆฏ navigator === null || navigator === void 0 ? void 0 : navigator.userAgent
ๅฏนไบ่ฟ็งๅ ผๅฎน nodeใWebใworker ็ฏๅข็ไปฃ็ ็ๆญฃ็กฎๅค็ๆนๅผๅบๆฏ๏ผ
conf-global
ๅ
๏ผ่ฏฅๅ
้ๅธธๅฐ๏ผ้ถไพ่ต๏ผไธไผๅขๅ ้กน็ฎ่ดๆ
๏ผ npm i conf-global
import "conf-global"
globalThis
ๅ
จๅฑๅฏน่ฑก่ฎฟ้ฎ็ๆนๅผ๏ผๅฆ๏ผ globalThis. navigator?. userAgent
"authing-js-sdk": "4.23.35",
โโโฌ [email protected]
โโโฌ [email protected]
โโโ [email protected]
MacOS
Module not found: Error: Can't resolve 'jsbn' in '/Users/linonetwo/xxx/TiddlyGit-Desktop/node_modules/authing-js-sdk/build/module/lib/sm-crypto/sm2'
ERROR in ./node_modules/authing-js-sdk/build/module/lib/sm-crypto/sm2/index.js 6:0-34
Module not found: Error: Can't resolve 'jsbn' in '/Users/linonetwo/Desktop/repo/TiddlyGit-Desktop/node_modules/authing-js-sdk/build/module/lib/sm-crypto/sm2'
@ ./node_modules/authing-js-sdk/build/module/lib/utils.js 39:0-50 48:38-47
@ ./node_modules/authing-js-sdk/build/module/lib/management/ManagementClient.js 53:0-35 67:21-28
@ ./node_modules/authing-js-sdk/build/module/index.js 1:0-50 1:0-50
@ ./src/components/TokenForm/gitTokenHooks.ts 3:0-54 6:38-58
ๅจไปๅคฉๅ็บงไพ่ตๆถ้ๅฐ่ฟไธช้ฎ้ขใๅฏ่ฝๆฏๅ ไธบไฝ ไปฌไพ่ต jsbn ็ๅบๅ็บงไบใ
2018/05/01 17:52:24 >>>>>>>>>request body
2018/05/01 17:52:24 {"query":"mutation($ids:[String!]!$operator:String!$registerInClient:String!){removeUsers(ids: $ids, registerInClient: $registerInClient, operator: $operator){_id,email,unionid}}","variables":{"ids":["5ae3d830f0db4b000117a95f"],"operator":"","registerInClient":"5adb75e03055230001023b26"}}
2018/05/01 17:52:24 >>>>>>>>>response body
2018/05/01 17:52:24 {"data":{"removeUsers":[]}}
ๆปๆฏ่ฟๅๆๅ๏ผๆฒกๆerrors๏ผ
่ฟไธช่ฆๆนๅช้๏ผๆน https://github.com/Authing/authing.js/blob/master/src/lib/authentication/AuthenticationClient.ts ๅ
็ๆ ทๅญๅบ่ฏฅๆฏ่ฆๅ ๅจ https://github.com/Authing/authing.js/blob/354968962ad217289c39b6a699adaee090254937/src/lib/authentication/SocialAuthenticationClient.ts#L32 ้๏ผ่ฟ้็ https://github.com/Authing/authing.js/blob/354968962ad217289c39b6a699adaee090254937/src/lib/authentication/SocialAuthenticationClient.ts#L144 ้ๆฒกๆ identities ๏ผ้่ฆๅ await ไธๆฌก graphql ่ฏทๆฑๆฅ่ทๅ identities
Type definitions for public API
ๆๅจๅฐWeb SDK้ๆๅฐๆ็ๅบ็จ็จๅบไธญ๏ผ้ๅฐไบไธไธช้ฎ้ขใ ๆ่ฝๆญฃ็กฎๆณจๅใ็ปๅฝใๆณจ้๏ผไฝๆๅจ้ช่ฏ็จๆท้ฎ็ฎฑ็ๆถๅไธ็ด้ๅฐ้ฎ้ขใ ๆๅจAuthingๆงๅถๅฐๅทฒ็ป่ฎพ็ฝฎๅฅฝไธบ็ตๅญ้ฎไปถ็ๆจกๆฟใ
ๅฝๆๆถๅฐๆฅ่ชAuthing็็ตๅญ้ฎไปถๆถ๏ผๆฏๆฌก็นๅปๆๆไพ็้พๆฅๅ้ช่ฏ้ฝๅคฑ่ดฅ๏ผ็ถๅ้ฝไผๆถๅฐไปฅไธ็ไฟกๆฏ๏ผ
้ช่ฏๅคฑ่ดฅ๏ผ่ทๅ้ฎไปถๆจกๆฟๅคฑ่ดฅ, ้กต้ขๅฐๅจ5็งๅๅ
ณ้ญโฆ
ๅจ่ฐ็จๅ้็ญไฟก็ๆถๅ๏ผ่ฟ้็data็ๅผๆฏ{ code: 200, message: 'ๅ้ๆๅ' }
๏ผ ่ฟๅ็ๆฏdata.data๏ผๅพๅฐไธไธชundefined
.
sendVerifyEmail
existed in the JS-SDK document but not in the sdk source code.
I'm submitting a ...
[x] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project
Summary
Refused to connect to 'https://tiddlygit-desktop.authing.cn/oidc/.well-known/jwks.json' because it violates the following Content Security Policy directive: "default-src 'self' 'unsafe-inline' data:". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.
dispatchXhrRequest @ xhr.js?9eca:178
KeyManager.js?450b:141 ๆๅกๅจ JWKS ็ซฏ็น่ฏทๆฑๅคฑ่ดฅ
eval @ KeyManager.js?450b:141
KeyManager.js?450b:142 Error: Network Error
at createError (webpack-internal:///./node_modules/authing-js-sdk/node_modules/axios/lib/core/createError.js:16)
at XMLHttpRequest.handleError (webpack-internal:///./node_modules/authing-js-sdk/node_modules/axios/lib/adapters/xhr.js:83)
My code:
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
import { useCallback, useMemo } from 'react';
import { AuthenticationClient } from 'authing-js-sdk';
import { SupportedStorageServices } from '@services/types';
import { APP_ID, APP_DOMAIN } from '@/constants/auth';
export function useAuth(storageService: SupportedStorageServices): [() => Promise<void>, () => Promise<void>] {
const authing = useMemo(
() =>
new AuthenticationClient({
appId: APP_ID,
appHost: APP_DOMAIN,
}),
[],
);
const onFailure = useCallback((error: Error) => {
console.error(error);
}, []);
const onClickLogout = useCallback(async () => {
await authing.logout();
await window.service.window.clearStorageData();
}, [authing]);
const onClickLogin = useCallback(async () => {
// clear token first, otherwise github login window won't give us a chance to see the form
// void this.auth.logout();
// window.remote.clearStorageData();
try {
await authing.social.authorize(storageService, {
onSuccess: async (user) => {
const thirdPartyIdentity = user.identities?.find((identity) => identity?.provider === storageService);
if (thirdPartyIdentity) {
if (thirdPartyIdentity.accessToken) {
await window.service.auth.set(`${storageService}-token`, thirdPartyIdentity.accessToken);
}
if (user.username) {
await window.service.auth.set(`${storageService}-userName`, user.username);
}
if (user.email) {
await window.service.auth.set(`${storageService}-email`, user.email);
}
}
},
onError: (code, message) => onFailure(new Error(message + String(code))),
});
} catch (error) {
onFailure(error);
}
}, [authing.social, onFailure, storageService]);
return [onClickLogin, onClickLogout];
}
Version: 4.23.29
Platform: Authing JS-SDK (Node)
=== npm audit security report ===
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Manual Review โ
โ Some vulnerabilities require your attention to resolve โ
โ โ
โ Visit https://go.npm.me/audit-guide for additional guidance โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ High โ Incorrect Comparison in axios โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Package โ axios โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Patched in โ >=0.21.2 โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Dependency of โ authing-js-sdk โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Path โ authing-js-sdk > axios โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ More info โ GHSA-cph5-m8f7-6c5x โ
โโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ High โ Server-Side Request Forgery in Axios โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Package โ axios โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Patched in โ >=0.21.1 โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Dependency of โ authing-js-sdk โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Path โ authing-js-sdk > axios โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ More info โ GHSA-4w2v-q235-vp99 โ
โโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Moderate โ Exposure of Sensitive Information to an Unauthorized Actor โ
โ โ in follow-redirects โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Package โ follow-redirects โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Patched in โ >=1.14.8 โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Dependency of โ authing-js-sdk โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Path โ authing-js-sdk > axios > follow-redirects โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ More info โ GHSA-pw2r-vq6v-hr8c โ
โโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ High โ Exposure of sensitive information in follow-redirects โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Package โ follow-redirects โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Patched in โ >=1.14.7 โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Dependency of โ authing-js-sdk โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Path โ authing-js-sdk > axios > follow-redirects โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ More info โ GHSA-74fj-2j2h-c42q โ
โโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
npm install authing-js-sdk
do -> npm audit
-->
ไฟฎๆนๅฏ็ ็ๆต็จ๏ผ
1ใๅ้้ฎไปถ
2ใๅกซๅ้ช่ฏ็
3ใไฟฎๆนๅฏ็
ๅฟ ้กปๆไพ้ช่ฏ็
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.