From 904a5f8afc8542f8116953c9d8ac93f7e3bfc0e5 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Thu, 17 Sep 2020 08:34:07 +1000 Subject: [PATCH] Fix token model dates to match spec 'At' vs 'On' Thanks for the example, one mistake I found when using this template: accessTokenExpiresAt instead of accessTokenExpiresOn refreshTokenExpiresAt instead of refreshTokenExpiresOn --- examples/mongodb/model.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/mongodb/model.js b/examples/mongodb/model.js index 1dc6a1f..8bbaf9d 100755 --- a/examples/mongodb/model.js +++ b/examples/mongodb/model.js @@ -12,11 +12,11 @@ var Schema = mongoose.Schema; mongoose.model('OAuthTokens', new Schema({ accessToken: { type: String }, - accessTokenExpiresOn: { type: Date }, + accessTokenExpiresAt: { type: Date }, client : { type: Object }, // `client` and `user` are required in multiple places, for example `getAccessToken()` clientId: { type: String }, refreshToken: { type: String }, - refreshTokenExpiresOn: { type: Date }, + refreshTokenExpiresAt: { type: Date }, user : { type: Object }, userId: { type: String }, })); @@ -79,11 +79,11 @@ module.exports.getUser = function(username, password) { module.exports.saveToken = function(token, client, user) { var accessToken = new OAuthTokensModel({ accessToken: token.accessToken, - accessTokenExpiresOn: token.accessTokenExpiresOn, + accessTokenExpiresAt: token.accessTokenExpiresAt, client : client, clientId: client.clientId, refreshToken: token.refreshToken, - refreshTokenExpiresOn: token.refreshTokenExpiresOn, + refreshTokenExpiresAt: token.refreshTokenExpiresAt, user : user, userId: user._id, });