Skip to content

Commit 0339b01

Browse files
Small fix for scope issue.
1 parent ac91be9 commit 0339b01

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

backend/src/routes/auth.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ router.get('/', (_req, res) => {
3434
function addOIDCRouterActivateWithTenant(strategyName, callbackURI, redirectURL) {
3535
router.get(callbackURI,
3636
passport.authenticate(strategyName, {
37-
failureRedirect: 'error'
37+
failureRedirect: 'error',
38+
scope: 'openid profile'
3839
}),
3940
(req, res) => {
4041
const userInfo = getSessionUser(req);
@@ -51,7 +52,8 @@ function addOIDCRouterActivateWithTenant(strategyName, callbackURI, redirectURL)
5152
function addOIDCRouterActivate(strategyName, callbackURI, redirectURL) {
5253
router.get(callbackURI,
5354
passport.authenticate(strategyName, {
54-
failureRedirect: 'error'
55+
failureRedirect: 'error',
56+
scope: 'openid profile'
5557
}),
5658
(_req, res) => {
5759
res.redirect(redirectURL);
@@ -66,7 +68,8 @@ addOIDCRouterActivateWithTenant('oidcEntraActivateDistrictUser', '/callback_acti
6668

6769
router.get('/callback_bceid',
6870
passport.authenticate('oidcBceid', {
69-
failureRedirect: 'error'
71+
failureRedirect: 'error',
72+
scope: 'openid profile'
7073
}),
7174
(req, res) => {
7275
const userInfo = getSessionUser(req);
@@ -79,7 +82,8 @@ router.get('/callback_bceid',
7982

8083
router.get('/callback_entra',
8184
passport.authenticate('oidcEntra', {
82-
failureRedirect: 'error'
85+
failureRedirect: 'error',
86+
scope: 'openid profile'
8387
}),
8488
(req, res) => {
8589
const userInfo = getSessionUser(req);
@@ -110,14 +114,14 @@ router.get('/silent_sdc_idir_login', async function (req, res, next) {
110114
res.status(401).json(UnauthorizedRsp);
111115
}
112116

113-
const authenticator = passport.authenticate('oidcIDIRSilent', { failureRedirect: 'error' });
117+
const authenticator = passport.authenticate('oidcIDIRSilent', { failureRedirect: 'error', scope: 'openid profile' });
114118
authenticator(req, res, next);
115119
});
116120

117121

118122
router.get(
119123
'/callback_idir_silent_sdc',
120-
passport.authenticate('oidcIDIRSilent', { failureRedirect: 'error' }),
124+
passport.authenticate('oidcIDIRSilent', { failureRedirect: 'error', scope: 'openid profile' }),
121125
async (req, res) => {
122126
if(!req.session.passport.user._json.idir_guid){
123127
await res.redirect(config.get('server:frontend') + '/unauthorized');
@@ -143,7 +147,8 @@ router.get(
143147

144148
router.get('/callback_idir',
145149
passport.authenticate('oidcIDIR', {
146-
failureRedirect: 'error'
150+
failureRedirect: 'error',
151+
scope: 'openid profile'
147152
}),
148153
(req, res) => {
149154
const userInfo = getSessionUser(req);
@@ -161,7 +166,7 @@ router.get('/error', (_req, res) => {
161166

162167
function addBaseRouterGet(strategyName, callbackURI) {
163168
router.get(callbackURI, passport.authenticate(strategyName, {
164-
scope: ['openid', 'profile'],
169+
scope: 'openid profile',
165170
failureRedirect: 'error'
166171
}));
167172
}

0 commit comments

Comments
 (0)