Skip to content

Commit 3acf16b

Browse files
committed
refactor(service): users/auth: call next middleware in oauth ingress protocol
1 parent 1794201 commit 3acf16b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

service/src/ingress/ingress.protocol.oauth.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,17 @@ export function createWebBinding(idp: IdentityProvider, passport: Authenticator,
125125
const oauth2Strategy = new OAuth2ProfileStrategy(strategyOptions, profileURL, verify)
126126
const handleIngressFlowRequest = express.Router()
127127
.get('/callback', (req, res, next) => {
128-
passport.authenticate(oauth2Strategy,
128+
const finishIngressFlow = passport.authenticate(
129+
oauth2Strategy,
129130
(err: Error | null | undefined, account: IdentityProviderUser, info: OAuth2Info) => {
130131
if (err) {
131132
return next(err)
132133
}
133134
req.user = { admittingFromIdentityProvider: { idpName: idp.name, account, flowState: info.state }}
134-
})(req, res, next)
135+
next()
136+
}
137+
)
138+
finishIngressFlow(req, res, next)
135139
})
136140
return {
137141
ingressResponseType: IngressResponseType.Redirect,

0 commit comments

Comments
 (0)