Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function checkToken($jwt, $getIdentity = false){
- $auth = false;
- try{
- $decoded = JWT::decode($jwt, $this->key, array('HS256'));
- }catch(UnexpectedValueException $e){
- $auth = false;
- }catch(DomainException $e){
- $auth = false;
- }
- if(is_object($decoded) && isset($decoded->sub)){
- $auth = true;
- }else{
- $auth = false;
- }
- if($getIdentity){
- return $decoded;
- }
- return $auth;
- }
- if(is_object($decoded) && isset($decoded->sub)){
- $auth = true;
- }else{
- $auth = false;
- }
Add Comment
Please, Sign In to add comment