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

Issue with complete example. #1

Open
saynono opened this issue Nov 27, 2017 · 1 comment
Open

Issue with complete example. #1

saynono opened this issue Nov 27, 2017 · 1 comment

Comments

@saynono
Copy link

saynono commented Nov 27, 2017

When retrieving user details multiple times request fails.
It seems as the model object is return wrong values.
user: { username: 'waychan23' }
After second call the object becomes
user: { username: { username: 'waychan23' } }
etc...

This can be solved by removing these lines from model.js:
token.client = { id: token.client };
token.user = { username: token.user };

Inside the api-router.js line 43 should look like this:
detail = userDb.get(user);

@jlow999
Copy link

jlow999 commented May 20, 2020

The correct way to fix it is to create a new token object instead of modifying it. The reason is, accessTokenStore.get() returns a reference to the token object.

Do this:

return {
  ...token,
  client:  {
    id: token.client
  },
  user: {
    username: token.user
  },
};

Not this:

token.client = { id: token.client };
token.user = { username: token.user };
return token;

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