How can I bypass auth to test my routes with sinon

Not sure if this is a duplicate but couldn’t find anything.

I need to test a bunch of routes using mocha and supertest, however every route is locked down with the following:

const { requiresAuth, auth } = require(“express-openid-connect”);

const AUTH_CONFIG = {
authRequired: false,
auth0Logout: true,
baseURL:
secret:
clientID:
issuerBaseURL: ,
routes: {
callback: “/auth0/callback”,
postLogoutRedirect: “/login”,
},
};

app.use(auth(AUTH_CONFIG));

app.use(
‘/route’
requiresAuth(),
);

Is there a way I can stub a response for requiresAuth() so i can bypass for testing? If not, how can I get around this issue?

Thank You

Hey there @mstart welcome to the community!

Have you considered just using a test user to go through the flow?

Let us know!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.