-
Notifications
You must be signed in to change notification settings - Fork 24
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
Refresh Token never expires #66
Comments
@HenrikZabel Sorry for my late response... I am looking into this right away |
@HenrikZabel I tried with your config and everything works fine. refresh token expires after 1 minute. About the response, you got the correct response. I will update the docs too to reflect the right response |
@eadwinCode That's strange. I still have the same problem. How did you test this? I just called the refresh api point, but it always worked (no matter if the refresh token expired or not) |
I copied your settings to a test project and it works. Can I see your ninja jwt setup? |
Sure:
|
I mean Controller registration and all. You have share the NinjaJWT before |
# api.py
from ninja_extra import NinjaExtraAPI
from ninja_jwt.controller import NinjaJWTDefaultController
from calendar_.api import router as week_router
from user.api import router as user_router
api = NinjaExtraAPI()
api.register_controllers(NinjaJWTDefaultController)
api.add_router("/calendar/", week_router)
api.add_router("/user/", user_router) # other api.py
…
@router.post("/task", response={200: Response, 403: Response}, auth=JWTAuth())
… |
Your routers, are they from |
The weird thing is - the package is working in general. I can create and get the tokens. But I cannot change the lifetime of them. Do you think this could be related to this? |
Anyways I have tried with router from both ninja and ninja_extra. And refresh token still gets expired |
Does it maybe clash with other installed libraries? But this should not be the case, right? |
I would suggest you try this https://github.com/jazzband/djangorestframework-simplejwt in your project to see if you have the same issue. This is not a permanent solution but we both need to understand where the problem is coming from. Whether is from your computer time or something. I need something to be able to debug and solve this issue for you. |
Hello,
and I can verify that the settings are taken into consideration because if I:
I obtain:
The access token expires correctly in 5 seconds, the refresh token doesn't expire. |
Alright I will look into this again |
@thomascenni I have tried it several times and can not reproduce it. What operating system are you using? |
I am on MacOS/Python 3.13; did you try with "REFRESH_TOKEN_LIFETIME": timedelta(seconds=10) and it expires ? |
I think this library has not been tested for python3.13 |
Sorry I made a mistake, I am on Python 3.12.6 (main, Sep 6 2024, 19:03:47) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin python:3.12.4-slim-bullseye |
I am on version 3.12.2. |
settings.py
I set the lifetime really low to test if the token expires. The access token is not usable after 30 seconds but the refresh token is usable as long as I want it to. Why is that?
When I request my api like that
And following is the response:
The response differs from what I can read here, which says the response looks like that:
Am I doing something wrong or is this unintentional?
The text was updated successfully, but these errors were encountered: