Hello there, I'm in need of assistance with building an API using inversify and inversify-express-utils. Everything seems to be working fine with my controllers and the API so far, except for one issue. When trying to access the httpContext property in my controller that comes from the BaseHttpController inheritance, I find that the user details are not showing up because the httpContext property is empty. I have followed the official documentation on configuring a custom Authentication provider as explained here.
Here is my code snippet:
app.ts
import AuthInversifyProvider from './providers/auth-inversify.provider';
export default class Application {
private readonly server: InversifyExpressServer;
private readonly environment: Environment;
private readonly rootPath = '/api/v1';
constructor(container: Container, environment: Environment) {
this.server = new InversifyExpressServer(container, null, {
rootPath: this.rootPath,
}, null, AuthInversifyProvider);
this.environment = environment;
}
public initialize(): ExpressApp {
// Code omitted for brevity
}
}
auth-inversify.provider.ts
// Code omitted for brevity
// Refer to documentation for full implementation details
// Picture references available at the provided links
This image serves as a reference to show successful retrieval of current user information: https://i.sstatic.net/tYxK3.png
Link to view my controller setup: https://i.sstatic.net/Kbn4L.png