Hi, I’ve deployed Taiga and have it running, I was wanting to link it to jitbit as it is able to make Post Requests to other sites. I read the documentation on the Rest API for taiga
I am running into the issue that the auth code resets every 8 days after a refresh, currently I have a crontab that is generating that code every friday, but due to how the web version of jitbit works I have to login and edit the automated process to use the new token that is generated.
Is there anyway to generate a token that never expires?
The application token looks like it could do it, but I don’t think that jitbit has a next_url after looking at their API.
Any help would be appreciated, I know this is more of a first world problem type issue, but if I ever use PTO for over a week this will break.
Since you are hosting your own instance, you can change the refresh or access token lifetime from the settings. That said, this would mean that every access token or refresh token would have that lifetime, not only yours. So if multiple people are using your instance, or you have it open to the world, that might not be desired.
Those settings can be found here in the repo. Depending on how you deployed Taiga, you may need to either just change the value and restart taiga-back service, or follow the advanced settings mapping and restart the docker container.
On the other hand, you could generate a token without an expiry date (or a really long one) from the django console. I’ll ping @david.barragan here.
This is a “hard method” but you can generate a pseudo-infinite auth token for some user ussing the python console. You just have to run the python shell with python mange.py shell (for source code setup) or ./taiga-manage.sh shell (for docker setup) and type this code
# First, import neccesary classes and functions
from datetime import timedelta
from taiga.users.models import User
from taiga.auth.tokens import AccessToken
# Now, show the current liftime for Access token
AccessToken.lifetime
# >> datetime.timedelta(days=1)
# Change it, temporarily, to 100 years, for example
AccessToken.lifetime = timedelta(days=365*100)
# Show the new value again
AccessToken.lifetime
# >> datetime.timedelta(days=36500)
# obtain the user, by their email
user = User.objects.get(email="user1@taigaio.demo")
# generate the access token
token = AccessToken.for_user(user)
# print the access token and use it in your api calls
str(token)
# >> 'eyJhbGciOi.....9OWw'