-
Notifications
You must be signed in to change notification settings - Fork 139
/
iframe.js
33 lines (28 loc) · 699 Bytes
/
iframe.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// This example needs to be run on https, see https://auth0.com/docs/libraries/secure-local-development
const express = require('express');
const { auth } = require('../');
const app = express();
app.use(
auth({
authRequired: false,
idpLogout: true,
session: {
cookie: {
sameSite: 'None',
},
},
})
);
app.get('/', (req, res) => {
if (req.oidc.isAuthenticated()) {
res.send(`hello ${req.oidc.user.sub}, <a href="/logout">logout</a>`);
} else {
res.send(`<a href="/login">login</a>`);
}
});
app.get('/iframe', (req, res) => {
res.send(`
<iframe src="https://localhost" style="width: 100%; height: 100%;"/>
`);
});
module.exports = app;