diff options
Diffstat (limited to 'server/models/oauth/oauth-token.ts')
-rw-r--r-- | server/models/oauth/oauth-token.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/server/models/oauth/oauth-token.ts b/server/models/oauth/oauth-token.ts index 759aa2779..026c30135 100644 --- a/server/models/oauth/oauth-token.ts +++ b/server/models/oauth/oauth-token.ts | |||
@@ -154,9 +154,12 @@ export class OAuthTokenModel extends Model<OAuthTokenModel> { | |||
154 | return OAuthTokenModel.scope(ScopeNames.WITH_ACCOUNT) | 154 | return OAuthTokenModel.scope(ScopeNames.WITH_ACCOUNT) |
155 | .findOne(query) | 155 | .findOne(query) |
156 | .then(token => { | 156 | .then(token => { |
157 | token['user'] = token.User | 157 | if (token) { |
158 | 158 | token['user'] = token.User | |
159 | return token | 159 | return token |
160 | } else { | ||
161 | return new OAuthTokenModel() | ||
162 | } | ||
160 | }) | 163 | }) |
161 | } | 164 | } |
162 | 165 | ||