GithubHelp home page GithubHelp logo

Comments (6)

mongkok avatar mongkok commented on May 26, 2024 1

In my opinion, ObtainJSONWebToken is a login process, the user sends his credentials and authenticates.

Perhaps it would be advisable to update it using the "Customizing" option and that each developer decides.

from django-graphql-jwt.

mongkok avatar mongkok commented on May 26, 2024

Thanks @tguillemot, that's a good question.

The reason to include the login is to send the user_logged_in signal and update the last_login user field.

I totally agree with you, ObtainJSONWebToken should not save the user session, login() must disappear and may be replaced by the signal.

from django.contrib.auth.signals import user_logged_in

user_logged_in.send(sender=user.__class__, request=info.context, user=user)

What do you think about sending this signal?

from django-graphql-jwt.

tguillemot avatar tguillemot commented on May 26, 2024

I had a look on how Django Rest Framework JWT solves that.
It seems that they prefer not updating last_login as explained on that issue.
As they said, by generating a JWT you fetch the user but do not update it.
I agree with that.

Do you have a case where last_login is useful for JWT ?

from django-graphql-jwt.

tguillemot avatar tguillemot commented on May 26, 2024

In my opinion, ObtainJSONWebToken is a login process, the user sends his credentials and authenticates.

We can see things like that indeed.

Perhaps it would be advisable to update it using the "Customizing" option and that each developer decides.

I do not have a strong feeling on that.
For me, it is not big deal if last_login is updated or not.
So, you can update last_login by default (or not) and if someone has a big problem with that one day he will open an issue anyway 😄.

Thanks for your answers and discussions !!!

from django-graphql-jwt.

mongkok avatar mongkok commented on May 26, 2024

Thanks, it was a pleasure talking to you :)

from django-graphql-jwt.

kukirokuk avatar kukirokuk commented on May 26, 2024

@mongkok last_login field is used as salt for generation tokens for links when email changes and password resets

from django-graphql-jwt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.