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

Return expiring date after Login #131

Closed
VolkerSchiewe opened this issue Oct 22, 2018 · 10 comments
Closed

Return expiring date after Login #131

VolkerSchiewe opened this issue Oct 22, 2018 · 10 comments

Comments

@VolkerSchiewe
Copy link

Is there a reason why only the user is returned along with the token and not also the expiring date or the expiring time-delta?

It could be very helpful to have this information to validate tokens in the frontend before using them.

@johnraz
Copy link
Collaborator

johnraz commented Oct 22, 2018

Could you elaborate a bit more?

What would be the usecase exactly?

What kind of validation should be done on a freshly generated token?

Thanks!

@belugame
Copy link
Collaborator

I see a use case where you have a long running client application that is desired to auto refresh it's tokens as long as the user is active (uses mouse, clicks etc) but does not necessarily interact with the backend.

@johnraz
Copy link
Collaborator

johnraz commented Oct 24, 2018

@belugame: that's a valid use case indeed.

I think we could simply setup a refresh token expiry endpoint that makes use of the auto-refresh feature behind the scene by forcing a refresh and return a simple payload like:

{
    token_expiry: <datetime>
}

We then could also add this in the payload returned by the login view.

If everybody agrees I'm up to implement it in the coming days 😉

@belugame
Copy link
Collaborator

sounds good to me, go for it :)

@VolkerSchiewe
Copy link
Author

The use case @belugame described is what i was thinking of: Long running client application, that know when the token is going to expire and can refresh it, or redirect the user to the login page.

The main idea was to get the expiring datetime together with the token.

@johnraz
Copy link
Collaborator

johnraz commented Oct 30, 2018

@VolkerSchiewe: great! it aligns with what I plan to do.

I hope to have some time soon to get my hands on this 👍

@abdelwahebmoalla
Copy link

Hey @johnraz is this feauture coming soon?

@johnraz
Copy link
Collaborator

johnraz commented Dec 22, 2018

It’s still on my radar yes but I can’t give you a specific ETA.

@sphrak
Copy link
Collaborator

sphrak commented Jan 8, 2019

@VolkerSchiewe @abdelwahebmoalla just letting you know PR #152 aims to solve what you guys are looking for :)

belugame added a commit that referenced this issue Jan 11, 2019
…etime-after-login

fixes #131 -- return expiry date on successful login
@johnraz
Copy link
Collaborator

johnraz commented Jan 14, 2019

@belugame: I suggest we close this and continue work in #156

MoisesRT pushed a commit to MoisesRT/django-rest-knox that referenced this issue Sep 15, 2019
dontexit pushed a commit to dontexit/django-rest-knox that referenced this issue Jan 24, 2024
dontexit pushed a commit to dontexit/django-rest-knox that referenced this issue Jan 24, 2024
…tion-datetime-after-login

fixes jazzband#131 -- return expiry date on successful login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants