PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, March 7, 2022

[FIXED] Get custom Claim in jwt-auth laravel

 March 07, 2022     jwt, laravel-5.1, lumen, php     No comments   

Issue

I need help to figure out a issues. I am using lumen(laravel 5.1) for create web services for mobile app. I am using JWT for authentication and it returns a token.

First issue is that if i use same token from another system/device then it validated and returns requested information. I want that token should be valid only for that device/system from user get token.

Second issue is that i have added some custom claims in JWT token. I want to get custom claim value from token. I have found similar question Get custom claims from a JWT using Owin but didn't get how i use it in php.

Please help me to get solution.


Solution

I got solution. Here is solution may be help someone else

$payload = JWTAuth::parseToken()->getPayload();
// then either of
$payload->get('foo');
$payload['foo'];


Answered By - Karan
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing