diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/oauth-client.js | 2 | ||||
-rw-r--r-- | server/models/oauth-token.js | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/server/models/oauth-client.js b/server/models/oauth-client.js index 830f68857..45834c5a5 100644 --- a/server/models/oauth-client.js +++ b/server/models/oauth-client.js | |||
@@ -29,5 +29,5 @@ function loadFirstClient (callback) { | |||
29 | } | 29 | } |
30 | 30 | ||
31 | function getByIdAndSecret (id, clientSecret) { | 31 | function getByIdAndSecret (id, clientSecret) { |
32 | return this.findOne({ _id: id, clientSecret: clientSecret }) | 32 | return this.findOne({ _id: id, clientSecret: clientSecret }).exec() |
33 | } | 33 | } |
diff --git a/server/models/oauth-token.js b/server/models/oauth-token.js index 23c698732..f6a814c36 100644 --- a/server/models/oauth-token.js +++ b/server/models/oauth-token.js | |||
@@ -28,7 +28,7 @@ mongoose.model('OAuthToken', OAuthTokenSchema) | |||
28 | // --------------------------------------------------------------------------- | 28 | // --------------------------------------------------------------------------- |
29 | 29 | ||
30 | function getByRefreshTokenAndPopulateClient (refreshToken) { | 30 | function getByRefreshTokenAndPopulateClient (refreshToken) { |
31 | return this.findOne({ refreshToken: refreshToken }).populate('client').then(function (token) { | 31 | return this.findOne({ refreshToken: refreshToken }).populate('client').exec().then(function (token) { |
32 | if (!token) return token | 32 | if (!token) return token |
33 | 33 | ||
34 | const tokenInfos = { | 34 | const tokenInfos = { |
@@ -47,9 +47,9 @@ function getByRefreshTokenAndPopulateClient (refreshToken) { | |||
47 | } | 47 | } |
48 | 48 | ||
49 | function getByTokenAndPopulateUser (bearerToken) { | 49 | function getByTokenAndPopulateUser (bearerToken) { |
50 | return this.findOne({ accessToken: bearerToken }).populate('user') | 50 | return this.findOne({ accessToken: bearerToken }).populate('user').exec() |
51 | } | 51 | } |
52 | 52 | ||
53 | function getByRefreshToken (refreshToken) { | 53 | function getByRefreshToken (refreshToken) { |
54 | return this.findOne({ refreshToken: refreshToken }) | 54 | return this.findOne({ refreshToken: refreshToken }).exec() |
55 | } | 55 | } |