r/react • u/ShininLotoen • 9d ago
Help Wanted Can't send JWTs from elixir backend on HTTP to react vite frontend on HTTPS
Hello,
I am working on a chat app project with a friend and am using React, and Vite for my frontend and Elixir Phoenix for my backend. I'm having trouble sending access and refresh tokens (made with Elixir Guardian) from my backend, which is on HTTP, to the React frontend, which is on HTTPS. Specifically, when I sign in on the frontend, neither tokens show up, the refresh token isn't in the cookies, and the access token isn't in the state I made for it. As a result, I can't access any of the apis that require one of these tokens.
However, when I switch my frontend back to HTTP (which is what I've had since the start and only switched to https recently), everything works as usual and the token from the backend are sent.
The code on the frontend to implement https goes as follows:
export default defineConfig({
plugins: [
react({
babel: {
plugins: [["babel-plugin-react-compiler"]],
},
}),
tailwindcss(),
basicSsl()
],If anyone would like more info on my codebase, I'd gladly add it.
Any help would be appreciated !