When calling a function in the module in this way
app.get("/api/sessions/oauth/google", (req, res) => {
return google_callback.googleOAuthHandler(req, res);
});
this points to the module and another function in the module can be accessed using this
googleOAuthHandler : async function (req, res) {
const code = req.query.code.toString();
const {id_token, access_token} = await this.getGoogleOAuthToken(code);
}
However passing the function as a parameter changes this to global and this.getGoogleOAuthToken becomes undefined
i.e when doing
app.get("/api/sessions/oauth/google", google_callback.googleOAuthHandler);
how would i access getGoogleOAuthToken in googleOAuthHandler in google_callback module when using this way