Advertisement
gasaichan

php_jwt_generator

Mar 25th, 2019
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.31 KB | None | 0 0
  1. function generateBearerToken($header, $payload, $key) {
  2.         $token_signature = hash_hmac(
  3.             'SHA256',
  4.             true64encode($header) .
  5.                 "." .
  6.                 true64encode($payload),
  7.             $key,
  8.             true
  9.         );
  10.  
  11.     return true64encode($header) .
  12.         "." .
  13.         true64encode($payload) .
  14.         "." .
  15.         true64encode($token_signature);
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement