1

I am new to development an making an app with Python Flask I want to increase the inactivity timer of my application.Currently I have tried the below mentioned solution but apparently it doesn't work.

app = Flask(__name__)
app.secret_key = "JWT SECRET"
app.config['JWT_EXPIRATION_DELTA'] = datetime.timedelta(seconds=3600)
app.config['JWT_REFRESH_EXPIRATION_DELTA'] = datetime.timedelta(seconds=3600)
jwt = JWTManager(app)
Ady
  • 21
  • 5

1 Answers1

2

If you look into the configuration documentation of JWT you can find the correct configuration options you require. They both need to be changed:

app = Flask(__name__)
app.secret_key = "JWT SECRET"
app.config['JWT_ACCESS_TOKEN_EXPIRES'] = datetime.timedelta(seconds=3600)
app.config['JWT_REFRESH_TOKEN_EXPIRES'] = datetime.timedelta(seconds=3600)
jwt = JWTManager(app)

Normally JWT_ACCESS_TOKEN_EXPIRES defaults to 15 minutes and JWT_REFRESH_TOKEN_EXPIRES defaults to 30 days.

rfkortekaas
  • 6,049
  • 2
  • 27
  • 34