express-oauth-server icon indicating copy to clipboard operation
express-oauth-server copied to clipboard

bug into redis example

Open antoniosap opened this issue 6 years ago • 5 comments

TypeError: expecting a function but got [object Object] on var db = require('bluebird').promisify(require('redis').createClient());

antoniosap avatar Mar 06 '18 10:03 antoniosap

Redis example is also missing saveAuthorizationCode, and using the wrong package oauth2-server vs express-oauth-server, and not initializing the class.

cryptiklemur avatar Mar 06 '18 19:03 cryptiklemur

and then ? trash everything ?

antoniosap avatar Mar 07 '18 09:03 antoniosap

Try using

const redis = require("redis");
const bluebird = require("bluebird");
bluebird.promisifyAll(redis.RedisClient.prototype);
const db = redis.createClient();

instead. I had the same error, and this fixed it.

tobilg avatar Apr 02 '18 18:04 tobilg

I had a lot of issues with the Redis example. I've now implemented a fully working example of Redis, and am planning on issuing a pull request to update the example this week.

moacode avatar Aug 14 '18 21:08 moacode

Have you update the redis example? I still got missing client grants because this block of code: The client in the .then(function(client) is a boolean "true", so of course client.grants is undefined. return promisify(this.model.getClient, 2).call(this.model, credentials.clientId, credentials.clientSecret) .then(function(client) { if (!client) { throw new InvalidClientError('Invalid client: client is invalid'); }

  if (!client.grants) {
    throw new ServerError('Server error: missing client `grants`');
  }

Rayan20 avatar Jun 01 '20 01:06 Rayan20