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

getters of Model, expected return value? #77

Closed
Uzlopak opened this issue Nov 17, 2021 · 1 comment
Closed

getters of Model, expected return value? #77

Uzlopak opened this issue Nov 17, 2021 · 1 comment

Comments

@Uzlopak
Copy link
Collaborator

Uzlopak commented Nov 17, 2021

Well. When I read #6 i realized:

The Model Implementations for the getters (e.g. getAccessToken) return strictly IToken.

So do we expect that model functions throw errors when the requested data is not existing?

The original documentation does not say anything regarding that
https://oauth2-server.readthedocs.io/en/latest/model/spec.html#model-getauthorizationcode

And what about the code examples in the documentation do not help at all as they are broken, as they never have returning any value (not tested, but by only reading the code). LOL

https://oauth2-server.readthedocs.io/en/latest/model/spec.html#model-getauthorizationcode

function getRefreshToken(refreshToken) {
  // imaginary DB queries
  db.queryRefreshToken({refresh_token: refreshToken})
    .then(function(token) {
      return Promise.all([
        token,
        db.queryClient({id: token.client_id}),
        db.queryUser({id: token.user_id})
      ]);
    })
    .spread(function(token, client, user) {
      return {
        refreshToken: token.refresh_token,
        refreshTokenExpiresAt: token.expires_at,
        scope: token.scope,
        client: client, // with 'id' property
        user: user
      };
    });
}
@jorenvandeweyer
Copy link
Member

I think we can close this since we now have #160

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