diff options
author | Sam Wilkins <samwilkins333@gmail.com> | 2019-09-03 19:21:36 -0400 |
---|---|---|
committer | Sam Wilkins <samwilkins333@gmail.com> | 2019-09-03 19:21:36 -0400 |
commit | 20e098859b13f37b0baf232682b032b98b85b6ea (patch) | |
tree | 993473fda6a44435bedf56e52cf0dda761605f25 /src/server/authentication/config/passport.ts | |
parent | 0c02b2ff3a41697c43d0aed98f330bd0293ef761 (diff) | |
parent | 25e8cc61f67bed3063dc81997d31f29e451b5610 (diff) |
Merge branch 'googlephotos' of https://github.com/browngraphicslab/Dash-Web into googlephotos
Diffstat (limited to 'src/server/authentication/config/passport.ts')
-rw-r--r-- | src/server/authentication/config/passport.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/server/authentication/config/passport.ts b/src/server/authentication/config/passport.ts index e5733cbb5..8b20d29b1 100644 --- a/src/server/authentication/config/passport.ts +++ b/src/server/authentication/config/passport.ts @@ -41,9 +41,11 @@ export let isAuthenticated = (req: Request, res: Response, next: NextFunction) = export let isAuthorized = (req: Request, res: Response, next: NextFunction) => { const provider = req.path.split("/").slice(-1)[0]; - if (_.find(req.user.tokens, { kind: provider })) { - next(); - } else { - res.redirect(`/auth/${provider}`); + if (req.user) { + if (_.find((req.user as any).tokens, { kind: provider })) { + next(); + } else { + res.redirect(`/auth/${provider}`); + } } };
\ No newline at end of file |