Just recently, I successfully deployed a rails backend and a vue frontend to Heroku. Everything was working fine until today when I encountered a problem while trying to log in to the web app. Immediately after logging in, I started receiving 401 responses because the app should be displaying my comic books from the database.
To provide some context, I have been following a Vue.js/Rails tutorial on YouTube by WebCrunch. In this tutorial, localStorage is utilized along with JWTSessions and axios. I referred to a question on Stack Overflow titled HttpGet 401 status code followed by 200 status code, but it did not contain the answer I was looking for. Additionally, I attempted to solve the issue by adding trailing slashes to my API URLs without success. The tutorial also mentioned the use of an axios/index.js file in the Vue frontend that configured instances of the axios requests.
Below are snippets of code used in the application:
// Code snippets here
I originally faced CORS-related issues but do not believe they are related to the current problem. My CORS issue occurred due to incorrect URL input without https in the browser header. To rectify this, I included both https and http URLs as origins. The desired outcome is that users should be able to login or sign up without being immediately logged out due to lack of authorization. If additional code is required for further analysis, kindly let me know. Thank you in advance.
Edit2: comics_controller.rb
// More code snippet here
Edit: Log output
// Continued log output details