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

Allow add extra information to token payload #265

Open
Tracked by #527
LinnaViljami opened this issue Jan 13, 2023 · 3 comments
Open
Tracked by #527

Allow add extra information to token payload #265

LinnaViljami opened this issue Jan 13, 2023 · 3 comments

Comments

@LinnaViljami
Copy link

No description provided.

@nrbnlulu
Copy link
Owner

Can you explain what you are misssing?

@LinnaViljami
Copy link
Author

So currently there is no setting to define what type of information we inject into JWT payload section.

So I would want to inhect additional timestamp to the JWT payload, like this:

{
      pk: <user-primary-key=field>,
      strongIdentification: <timestamp-indicates-the-time-user-has-identified-using-bank-account>
}

However, currently our JWT payload handler is assumed to return TokenPayloadType, which consist on the following fields

@strawberry.type(
    description="""
the data that was used to create the token.
"""
)
@inject_fields(
    {
        app_settings.JWT_PAYLOAD_PK,
    }
)
class TokenPayloadType:
    origIat: datetime = strawberry.field(
        description="when the token was created", default_factory=datetime.utcnow
    )
    exp: datetime = strawberry.field(description="when the token will be expired", default=None)

So we can not add an extra field into token payload

@LinnaViljami
Copy link
Author

I already have implemented custom JWT_PAYLOAD_HANDLER but it does not help me to add extra field to the payload

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

2 participants