Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: vercel middleware stripping auth headers #66

Open
wants to merge 2 commits into
base: staging
Choose a base branch
from

Conversation

Copy link

vercel bot commented Oct 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
45group ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2024 10:32pm

Comment on lines -12 to -32
const pathname = req.nextUrl.pathname;
// const sessionToken =
// req.cookies.get(SESSION_KEY)?.value || req.headers.get("Authorization")?.split(" ")[1];

// if (protectedRoutes.some((path) => pathname.startsWith(path))) {
// if (!sessionToken) {
// return appError({ status: 401, error: "No session provided" });
// }

// const {
// data: { user_id },
// } = await axiosInstance.post("/api/utils/decode", { session: sessionToken });

// if (!user_id) {
// return appError({ status: 401, error: "Invalid session" });
// }

// const res = NextResponse.next();
// res.headers.set(HEADER_DATA_KEY, user_id);
// return res;
// }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

superfluous

Comment on lines -61 to -89
const status = error?.response?.status;

// if (status === 401) {
// // const refreshToken = await getCookie(JWT_KEY);

// // if (!refreshToken) {
// // return Promise.reject(error);
// // }

// // try {
// // const { access, refresh } = await AuthService.refreshJwt({
// // refresh: refreshToken,
// // });

// // if (access && refresh) {
// // axiosPrivate.defaults.headers.common["Authorization"] = "Bearer " + access;
// // await setCookie(JWT_KEY, refresh);
// // }
// // } catch (error) {
// // if (isAxiosError(error)) {
// // if (error.response?.status === 401) {
// // await deleteCookie(JWT_KEY);
// // }
// // }
// // }

// return axiosPrivate.request(error?.config);
// }

Copy link
Member Author

@iamogbz iamogbz Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

superfluous

Comment on lines -15 to -20
const cache: {
user: User | null;
} = {
user: null,
};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

superfluous

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant