What is the error you encounter?
I guess that this is this part:
// Redirect to myStockroom page after a brief delay
setTimeout(() => {
window.location.href = "http://127.0.0.1:5555/myStockroom"; // Use absolute URL
}, 1500);
and your server answers that it is not possible to GET
there because of @jwt_required
?
If this is the case, this can be explained because the browser will not add the Authorization:
header to the GET
. Hence first you login, then you are redirected to /myStockroom
but this request is refused by the server because it requires a JWT.
Please post console log from the browser and from the flask output to confirm this.
If this is the problem, you could add the JWT token in a cookie when /login
and tell that to the decorator @jwt_required(locations='cookie')
. The cookie name seems configurable with JWT_ACCESS_COOKIE_NAME
and defaults to access_token_cookie
.