Hi, i am trying to integrate sessions with tower sessions but session resetting after each request #193
-
|
Here my main function file which i added the sesion layer `#[tokio::main] }` in my login handler function's end i inserted to session the test value as 1, and in the begining of the function i printed the session test value. Results After i run this handler several times session test value always printed as None. Conclusion Session is not storaged or always resetting ` }` |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
|
Can you provide a runnable example? Also please try one of the provided examples: can you produce the same problem with one of those? |
Beta Was this translation helpful? Give feedback.
-
|
I wrote this to check if the session working properly and it is working with this way |
Beta Was this translation helpful? Give feedback.
-
|
And i also tested it with this function and it worked |
Beta Was this translation helpful? Give feedback.
-
|
But on my frontend app i used post request to login to login handler login handler on the server side post request to login from frontend app middleware router file that i implement the authentication But i got unauthorized error on the pages where my middleware checks the logged_in value |
Beta Was this translation helpful? Give feedback.
-
|
Here is the project link https://github.com/kalinux0/simple-rust-usage |
Beta Was this translation helpful? Give feedback.
You need to tell fetch to include the cookies. For example:
fetch(url, {
credentials: "same-origin"
})