Advertisement
Guest User

Mongoose LoginSchema with jwt token-store

a guest
Oct 11th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const LoginSchema = new Schema({
  2.     username: {
  3.         type: String,
  4.         unique: true
  5.     },
  6.     email: {
  7.         type: String,
  8.         unique: true
  9.     },
  10.     password: {
  11.         type: String,
  12.         minlength: 8
  13.     },
  14.     tokens: [
  15.         {
  16.             tokenString: {
  17.                 type: String
  18.             },
  19.             tokenType: {
  20.                 type: String,
  21.                 enum: ['access', 'refresh']
  22.             },
  23.             isBlacklisted: {
  24.                 type: Boolean,
  25.                 default: false
  26.             }
  27.         }
  28.     ]
  29. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement