refactor: fix oauth demo which has little problem

pull/100/head
moonrailgun 2 years ago
parent b038c5adf3
commit 8fc96b7918

@ -574,7 +574,7 @@ importers:
version: 0.32.11
zustand:
specifier: ^4.3.6
version: 4.3.6(immer@9.0.15)(react@18.2.0)
version: 4.3.6(immer@9.0.21)(react@18.2.0)
devDependencies:
'@types/crc':
specifier: ^3.4.0
@ -1875,7 +1875,7 @@ importers:
version: 5.3.6(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0)
zustand:
specifier: ^4.3.6
version: 4.3.6(immer@9.0.15)(react@18.2.0)
version: 4.3.6(immer@9.0.21)(react@18.2.0)
server/plugins/com.msgbyte.getui:
dependencies:
@ -2053,7 +2053,7 @@ importers:
version: 5.3.6(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0)
zustand:
specifier: ^4.3.6
version: 4.3.6(immer@9.0.15)(react@18.2.0)
version: 4.3.6(immer@9.0.21)(react@18.2.0)
server/plugins/com.msgbyte.welcome:
dependencies:
@ -2125,6 +2125,10 @@ importers:
openid-client:
specifier: ^5.1.5
version: 5.3.2
devDependencies:
ts-node:
specifier: 10.9.1
version: 10.9.1(@types/node@18.11.9)(typescript@4.9.4)
server/test/demo/openapi-client-simple:
dependencies:
@ -2134,6 +2138,10 @@ importers:
express:
specifier: ^4.17.2
version: 4.18.2
devDependencies:
ts-node:
specifier: 10.9.1
version: 10.9.1(@types/node@18.11.9)(typescript@4.9.4)
website:
dependencies:
@ -21749,10 +21757,10 @@ packages:
/immer@9.0.15:
resolution: {integrity: sha512-2eB/sswms9AEUSkOm4SbV5Y7Vmt/bKRwByd52jfLkW4OLYeaTP3EEiJ9agqU0O/tq6Dk62Zfj+TJSqfm1rLVGQ==}
dev: false
/immer@9.0.21:
resolution: {integrity: sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA==}
dev: false
/import-fresh@2.0.0:
resolution: {integrity: sha512-eZ5H8rcgYazHbKC3PG4ClHNykCSxtAhxSSEM+2mb+7evD2CKF5V7c0dNum7AdpDh0ZdICwZY9sRSn8f+KH96sg==}
@ -36412,6 +36420,7 @@ packages:
immer: 9.0.15
react: 18.2.0
use-sync-external-store: 1.2.0(react@18.2.0)
dev: false
/zustand@4.3.6(immer@9.0.21)(react@18.2.0):
resolution: {integrity: sha512-6J5zDxjxLE+yukC2XZWf/IyWVKnXT9b9HUv09VJ/bwGCpKNcaTqp7Ws28Xr8jnbvnZcdRaidztAPsXFBIqufiw==}
@ -36428,7 +36437,6 @@ packages:
immer: 9.0.21
react: 18.2.0
use-sync-external-store: 1.2.0(react@18.2.0)
dev: false
/zwitch@1.0.5:
resolution: {integrity: sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==}

@ -6,6 +6,7 @@ import path from 'path';
import assert from 'assert';
import qs from 'qs';
import _ from 'lodash';
import serve from 'serve-static';
import { TcOIDCAdapter } from './adapter';
import { claimUserInfo } from './account';
import type { UserLoginRes } from '../../../models/user/user';
@ -300,6 +301,15 @@ class OIDCService extends TcService {
'GET /.well-known/openid-configuration': providerRoute,
},
},
{
// For css file in development
path: '/',
authentication: false,
authorization: false,
use: [serve('public')],
whitelist: [],
autoAliases: false,
},
];
}

@ -7,8 +7,8 @@ const port = 8080;
const API = process.env.API || 'http://localhost:11001';
const clientUrl = `http://localhost:${port}`;
const clientId = process.env.ID || 'tc_61f5270008e0635f67868f01';
const clientSecret = process.env.SECRET || 'PDnLVsNnFyqWRS0QXYeaHDlE8KwgQLqv';
const clientId = process.env.ID || 'tc_649aa2179e97b8b3b2d1004f';
const clientSecret = process.env.SECRET || '4Pt4lccOaztJROs-VhmQf8XBU89-z8rr';
console.log('config:', {
API,
@ -80,6 +80,8 @@ app.get('/cb', async (req, res, next) => {
});
app.listen(port, () => {
console.log(`请确保回调已经被注册在OIDC服务端的白名单中: ${clientUrl}/cb`);
console.log(
`请确保第三方登录功能已启动并且回调已经被注册在OIDC服务端的白名单中: ${clientUrl}/cb`
);
console.log(`测试服务地址: http://127.0.0.1:${port}`);
});

@ -9,9 +9,12 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "GPL-3.0",
"license": "MIT",
"dependencies": {
"axios": "^0.26.0",
"express": "^4.17.2"
},
"devDependencies": {
"ts-node": "10.9.1"
}
}

@ -7,8 +7,8 @@ const port = 8080;
const API = process.env.API || 'http://localhost:11001';
const clientUrl = `http://localhost:${port}`;
const clientId = process.env.ID || 'tc_61f5270008e0635f67868f01';
const clientSecret = process.env.SECRET || 'PDnLVsNnFyqWRS0QXYeaHDlE8KwgQLqv';
const clientId = process.env.ID || 'tc_649aa2179e97b8b3b2d1004f';
const clientSecret = process.env.SECRET || '4Pt4lccOaztJROs-VhmQf8XBU89-z8rr';
console.log('config:', {
API,
@ -36,7 +36,7 @@ const request = axios.create({
(async () => {
const tailchatIssuer = await Issuer.discover(
'https://paw-server-nightly.moonrailgun.com/open/'
'https://tailchat-nightly.moonrailgun.com/open/'
);
console.log(
'Discovered issuer',

@ -9,10 +9,13 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "GPL-3.0",
"license": "MIT",
"dependencies": {
"axios": "^0.26.0",
"express": "^4.17.2",
"openid-client": "^5.1.5"
},
"devDependencies": {
"ts-node": "10.9.1"
}
}

Loading…
Cancel
Save