Skip to content
This repository was archived by the owner on Sep 27, 2022. It is now read-only.
This repository was archived by the owner on Sep 27, 2022. It is now read-only.

dt.strftime('%S') #3

@srdavicho

Description

@srdavicho

I could runserver following hunterway55 comments: upgrading to django=1.10.5 and adding django-cors-headers==1.3.1, but the Postman register & login commands didn't work.

In apps/authentication/models.py

I replaced dt.strftime('%s') by dt.strftime('%S') and the Login & Register commands worked.

Token generation function is now:

def _generate_jwt_token(self):
    """
    Generates a JSON Web Token that stores this user's ID and has an expiry
    date set to 60 days into the future.
    """
    dt = datetime.now() + timedelta(days=60)

    token = jwt.encode({
        'id': self.pk,
        'exp': int(dt.strftime('%S'))
    }, settings.SECRET_KEY, algorithm='HS256')

    return token.decode('utf-8')

Hope it helps someone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions