Skip to content
This repository has been archived by the owner. It is now read-only.

client-tokens - memory db returns client createdAt instead of token createdAt #421

Closed
vladikoff opened this issue Sep 28, 2016 · 0 comments
Closed
Assignees

Comments

@vladikoff
Copy link
Contributor

@vladikoff vladikoff commented Sep 28, 2016

Ref: Memory https://github.com/mozilla/fxa-oauth-server/blob/master/lib/db/memory.js#L256

Ref: SQL

// Token management by uid.
// Returns the most recent token used with a client name and client id.
// Does not include clients that canGrant.
const QUERY_ACTIVE_CLIENT_TOKENS_BY_UID =
'SELECT DISTINCT clients.name, clients.id, MAX(tokens.createdAt) as createdAt FROM clients, tokens ' +
'WHERE tokens.expiresAt > NOW() AND clients.canGrant = 0 AND clients.id = tokens.clientId AND tokens.userId=? ' +
'GROUP BY id ' +
'ORDER BY createdAt DESC, clients.name ' +
'LIMIT 10000;';

We use MAX(tokens.createdAt) to sort by newest token in MySQL, but we just pick up .createdAt field in the memory db.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants