Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated api token not valid after some hours #593

Open
smart-clouds-09 opened this issue Feb 4, 2024 · 6 comments
Open

Generated api token not valid after some hours #593

smart-clouds-09 opened this issue Feb 4, 2024 · 6 comments
Assignees
Labels
3.0.3 documentation Improvements or additions to documentation

Comments

@smart-clouds-09
Copy link

The tokens, which are generated with create_token.sh are not valid anymore after a time, in my case some hours.
I have been using the token for papermerge-cli to import docs. After a time papermerge-cli throws :

/usr/local/lib/python3.10/site-packages/pydantic/_migration.py:283: UserWarning: pydantic.generics:GenericModel has been moved to pydantic.BaseModel.
warnings.warn(f'{import_path} has been moved to {new_location}.')
Unauthorized

Is a new token generated, it works for a while

Info:

  • Papermerge Version 3.0.3
@smart-clouds-09 smart-clouds-09 added the bug Something isn't working label Feb 4, 2024
@ciur
Copy link
Owner

ciur commented Feb 9, 2024

Default expiration time for the token is 360 minutes (i.e. 6 hours). If you want to change that use PAPERMERGE__SECURITY__TOKEN_EXPIRE_MINUTES settings. I forgot to add that to docs. I will mark this ticket as documentation issue and update documentation accordingly.

@ciur ciur added documentation Improvements or additions to documentation 3.0.3 and removed bug Something isn't working labels Feb 9, 2024
@smart-clouds-09
Copy link
Author

thanks, is there a value for unexpired ?

@ciur
Copy link
Owner

ciur commented Feb 10, 2024

I've updated documentation.

Is there a value for unexpired

No. Just set it to big enough value. E.g. 525600 (60x24x365) is the number of minutes in a year.

@smart-clouds-09
Copy link
Author

meanwhile I have written a script, which updates the token after a few minutes. Thank for updating the docs

@ciur ciur closed this as completed Feb 10, 2024
@WolfgangFahl
Copy link

WolfgangFahl commented Aug 24, 2024

Please reopen the issue and change the default to at least 1 year.
https://docs.papermerge.io/3.0/rest-api/token/ is also hard to find - this should be part of describing the API

@ciur ciur reopened this Aug 24, 2024
@WolfgangFahl
Copy link

WolfgangFahl commented Aug 25, 2024

thx i am using

# Token expiration time in minutes. Here, it's set to 2 years (1051200 minutes).
# Adjust as necessary for your security requirements.
PAPERMERGE__SECURITY__TOKEN_EXPIRE_MINUTES=1051200

as a workaround in the papermerge script at https://github.com/WolfgangFahl/scan2wiki/blob/main/scripts/papermerge

see also https://wiki.bitplan.com/index.php/Papermerge#Exploring_the_environment_variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.0.3 documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants