Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[potential bug] examples/membory/model.js#saveToken not returning any value #52

Open
bchenSyd opened this issue Jul 10, 2017 · 1 comment

Comments

@bchenSyd
Copy link

bchenSyd commented Jul 10, 2017

is this a bug as it didn't return anything

@wooliet
Copy link

wooliet commented Oct 10, 2017

Looks like it to me, otherwise the data passed to TokenModel is undefined.

handle method in /oauth2-server/lib/handlers/token-handler.js:

    .then(function(client) {
      return this.handleGrantType(request, client);
    })
    .tap(function(data) {
      var model = new TokenModel(data, {allowExtendedTokenAttributes: this.allowExtendedTokenAttributes});

Also, TokenModel is looking for client instead of clientId and user instead of userId.

MemoryCache.prototype.saveToken = function(token, client, user) {
  const data = {
    accessToken: token.accessToken,
    accessTokenExpiresAt: token.accessTokenExpiresAt,
    client: client.clientId,
    refreshToken: token.refreshToken,
    refreshTokenExpiresAt: token.refreshTokenExpiresAt,
    user: user.id
  };
  this.tokens.push(data);
  return data;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants