Check Session is Valid

I'm developing a script that will execute a request routine for various tasks, but a problem that I think I may have is excessive authentication, so I'm wondering if there is a lib or within reqwest a way to check if that session is valid, otherwise it authenticates again.

Thanks in advance

What is a session in your context? Can't you make as many requests as possible till you get a 401 or 403 or such from your server and then reauthenticate?

1 Like

It would be when the Cookie was no longer valid, it would be possible to set up something more "by hand" and if that cookie had expired, it would authenticate, I think a good example is the Session Request in Python, right?

I'm not aware of what a session request in Python is. Do you mean requests.Session? In which case, the documentation sounds like a session is more akin to reqwest::Client than to a more high level construct that handles re-authentication for you.

I think this is a problem that is missing in the library, I saw some topics open and using other packages to handle session management

I disagree with you on this one. Session management and authentication vary greatly between vendors and applications, except maybe OAuth-based IAM solutions. I don't think a library that would implement all the different ways people do access mamangement over HTTP would be feasible, and I don't believe reqwest should try to be that library.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.