Skip to content

getters of Model, expected return value? #77

Closed
@Uzlopak

Description

@Uzlopak

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
      };
    });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions