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

Mixing `oauth2-server` versions breaks `instanceof` Require

Open wallzero opened this issue 6 years ago • 0 comments

If using this project with latest oauth2-server, express-oauth-server will fail if using custom express middleware. For example:

      const req = new Request(request);
      const res = new Response(response);

      expressOAuthServer.server.token(req, res).then(() => {
          /* stuff */
      })

The above will throw this error.

This occurs if the parent project is using a newer version of oauth2-server than the one listed in express-oauth-server package.json. The instanceof fails I suppose due to newer class properties; though I haven't looked into it.

A workaround is to import Require and Response from node_modules/express-oauth-server/node_modules/oauth2-server. This will be fixed once the project is updated to use the latest oauth2-server.

wallzero avatar Oct 20 '18 07:10 wallzero