Skip to content

Try to reauthenticate on a http status code 403#59

Open
pnbecker wants to merge 4 commits intomainfrom
reauthenticate
Open

Try to reauthenticate on a http status code 403#59
pnbecker wants to merge 4 commits intomainfrom
reauthenticate

Conversation

@pnbecker
Copy link
Member

@pnbecker pnbecker commented Feb 2, 2026

If we get a http status code 403, we should try to reauthenticate in case the session timed out. If we then still get the error, our user might miss the permissions for the requested action.

@pnbecker pnbecker requested a review from dpk February 2, 2026 17:20
@pnbecker pnbecker added the enhancement New feature or request label Feb 2, 2026
@quasipoint quasipoint removed the request for review from dpk February 3, 2026 09:56
@pnbecker pnbecker requested a review from quasipoint February 3, 2026 10:01
If we get a http status code 403, we should try to reauthenticate in
case the session timed out. If we then still get the error, our user
might miss the permissions for the requested action.
Using a decorator to achieve this.
@pnbecker
Copy link
Member Author

pnbecker commented Feb 3, 2026

@quasipoint thank you. I like the idea with the decorator. I used it to refresh the csrf token and to handle the reauthenication.

I have not tested this code yet. Could you please do a code review and if that looks better to you now, I will test the code.

@pnbecker pnbecker requested a review from quasipoint February 3, 2026 17:32
# as this method doesn't return the request, we cannot use our @reauthenticate decorator
# we should enhance self.api_post to be able to send files and use our decorators
if r.status_code == 401 and not reauthenticated:
self.reauthenticate

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be self.authenticate()? This is a no-op as written

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, fixed, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants