1
This commit is contained in:
parent
fc6130fdb2
commit
5f052f7efa
@ -1,32 +0,0 @@
|
|||||||
const express = require('express');
|
|
||||||
const { auth, requiresAuth } = require('express-openid-connect');
|
|
||||||
const app = express();
|
|
||||||
|
|
||||||
const config = {
|
|
||||||
authRequired: false,
|
|
||||||
auth0Logout: true,
|
|
||||||
baseURL: 'http://localhost:3000',
|
|
||||||
clientID: '{yourClientId}',
|
|
||||||
issuerBaseURL: 'https://{yourDomain}',
|
|
||||||
secret: 'LONG_RANDOM_STRING'
|
|
||||||
};
|
|
||||||
|
|
||||||
// The `auth` router attaches /login, /logout
|
|
||||||
// and /callback routes to the baseURL
|
|
||||||
app.use(auth(config));
|
|
||||||
|
|
||||||
// req.oidc.isAuthenticated is provided from the auth router
|
|
||||||
app.get('/', (req, res) => {
|
|
||||||
res.send(
|
|
||||||
req.oidc.isAuthenticated() ? 'Logged in' : 'Logged out'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// The /profile route will show the user profile as JSON
|
|
||||||
app.get('/profile', requiresAuth(), (req, res) => {
|
|
||||||
res.send(JSON.stringify(req.oidc.user, null, 2));
|
|
||||||
});
|
|
||||||
|
|
||||||
app.listen(3000, function() {
|
|
||||||
console.log('Listening on http://localhost:3000');
|
|
||||||
});
|
|
1258
server/web3test/package-lock.json
generated
1258
server/web3test/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"dependencies": {
|
|
||||||
"express": "^4.19.2",
|
|
||||||
"express-openid-connect": "^2.17.1"
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user