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

Lumen passport custom data in payload #165

Closed
aagjalpankaj opened this issue Nov 1, 2021 · 5 comments · Fixed by #174
Closed

Lumen passport custom data in payload #165

aagjalpankaj opened this issue Nov 1, 2021 · 5 comments · Fixed by #174

Comments

@aagjalpankaj
Copy link

How to pass custom data (like user_id, roles, etc) in payload along with sub?

@dusterio
Copy link
Owner

dusterio commented Nov 1, 2021

Do you mean to include extra data in the JWT token itself, in its JSON payload?

@aagjalpankaj
Copy link
Author

@dusterio - Yes.

@aagjalpankaj
Copy link
Author

@dusterio - e.g.

{
  "aud": "9420abb1-1470-4895-8666-a702b415cb59",
  "jti": "1dd56723fa5ac4421ebb7cb9a0222686f368de22760d9ac7038b8a3a696ac12069b84e2434ea9d75",
  "iat": 1635772661.715073,
  "nbf": 1635772661.71508,
  "exp": 1635774461.676158,
  "sub": "8707e4a1-a920-40dc-a472-b71b62343dca",
  "user_id": 123,
  "sites": { "78": 1, "60": 3 }
  "scopes": []
}

In the above payload "user_id" & "sites" is the custom data. How to pass such custom data using this package? We can do this in "tymon/jwt-auth" - https://medium.com/geekculture/restrict-jwt-token-with-ip-address-using-laravel-77ce5ae3671a

@fcirone
Copy link

fcirone commented Jan 31, 2022

@dusterio +1. Any way to achieve it?

@dusterio
Copy link
Owner

dusterio commented Feb 1, 2022

I think there are some examples at the end of this thread:
laravel/passport#94

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

Successfully merging a pull request may close this issue.

3 participants