Created
December 9, 2018 05:51
-
-
Save asule90/95dbffa359526d3b843ee1457a998ea2 to your computer and use it in GitHub Desktop.
Code snippet for UserController example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $payload = [ | |
| 'iss' => 'Organization', // Issuer of the token, Organization / Product | |
| 'sub' => 'subject', // Subject of the token | |
| 'iat' => time(), // Time when JWT was issued. | |
| 'exp' => time() + 60*60 // Expiration time | |
| ... | |
| 'user' => ..., | |
| 'desc' => ..., | |
| ]; | |
| $jwt = JWT::encode($payload, env('JWT_SECRET')); | |
| $result = true; | |
| $message = 'Login succeed'; | |
| $user_data = ... | |
| return ['result'=>$result, 'message'=>$message, 'token'=>$jwt, 'user'=>$user_data]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment