Skip to content

Commit

Permalink
fix(authentication-oauth): session.destroy is undefined when use cook…
Browse files Browse the repository at this point in the history
…ie-session package (#2100)
  • Loading branch information
fadiquader committed Nov 8, 2020
1 parent 09b62c0 commit 46e84b8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/authentication-oauth/src/express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,14 @@ export default (options: OauthSetupSettings) => {
...payload
};

await new Promise((resolve, reject) =>
req.session.destroy(err => err ? reject(err) : resolve())
);
await new Promise((resolve, reject) => {
if (!req.session.destroy) {
req.session = null;
resolve();
}

req.session.destroy(err => err ? reject(err) : resolve());
});

debug(`Calling ${authService}.create authentication with strategy ${name}`);

Expand Down

0 comments on commit 46e84b8

Please sign in to comment.