Registering a custom strategy which extends an existing one throws an error
// Custom Class
class MyLocalStrategy extends LocalStrategy {
getEntityQuery(query, params) {
// Query for user but only include users marked as `active`
return {
...query,
active: true,
$limit: 1,
};
}
}
// authentication.js
export default app => {
const authentication = new AuthenticationService(app);
authentication.register("jwt", new JWTStrategy());
authentication.register("local", new MyLocalStrategy(););
app.use("/authentication", authentication);
app.configure(expressOauth());
}
Expected behavior
The app should run smoothly because it's only a custom class which extends an existing one
Steps to reproduce
Registering a custom strategy which extends an existing one throws an error
Expected behavior
Actual behavior
TypeError: Class constructor LocalStrategy cannot be invoked without 'new' at new MyLocalStrategy