This repository has been archived by the owner on May 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add passport-jwt (MEL-12) (#31)
- Loading branch information
Showing
3 changed files
with
30 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
import { AUTH_TOKEN, MONGODB_URI } from './env' | ||
import MongoStore from 'connect-mongo' | ||
import { ExtractJwt } from 'passport-jwt' | ||
|
||
export const sessionConfig = { | ||
// TODO: We can think about potential migration to Memcached with following package: https://www.npmjs.com/package/connect-memcached | ||
store: new MongoStore({ | ||
mongoUrl: MONGODB_URI, | ||
collectionName: 'sessions', | ||
}), | ||
secret: AUTH_TOKEN, | ||
// NOTE: "secure" should be turned on on production, it requires https to work at all so it's disabled during development time, maybe we can make it relative to NODE_ENV. | ||
secure: false, | ||
resave: false, | ||
saveUninitialized: false, | ||
} | ||
|
||
export const jwtConfig = { | ||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), | ||
secretOrKey: AUTH_TOKEN, | ||
// issuer: 'araclx.com', | ||
// audience: 'm3llo.co' | ||
} |