Skip to content

Commit

Permalink
Update to use "firebase/php-jwt": "^6.0"
Browse files Browse the repository at this point in the history
  • Loading branch information
frasermurraysco committed Feb 20, 2023
1 parent ac6f48d commit af83dc3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
12 changes: 5 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@
"homepage": "https://github.com/macsidigital/laravel-api-client",
"license": "MIT",
"type": "library",
"authors": [
{
"name": "Colin Hall",
"email": "colin@macsi.co.uk"
}
],
"authors": [{
"name": "Colin Hall",
"email": "colin@macsi.co.uk"
}],
"require": {
"php": "^7.3|^8.0|^8.1",
"nesbot/carbon": "^1.26.3 || ^2.0",
"guzzlehttp/guzzle": "~7.0|~6.0|~5.0|~4.0",
"firebase/php-jwt": "^5.0",
"firebase/php-jwt": "^6.0",
"illuminate/support": "^7.0|^8.0|^9.0|^10.0",
"macsidigital/laravel-oauth2-client": "^1.2|^2.0"
},
Expand Down
5 changes: 3 additions & 2 deletions src/Support/Authentication/JWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

namespace MacsiDigital\API\Support\Authentication;

use Firebase\JWT\Key;
use Firebase\JWT\JWT as FirebaseJWT;

class JWT
{
public static function generateToken($token, $secret)
{
return FirebaseJWT::encode($token, $secret);
return FirebaseJWT::encode($token, $secret, 'HS256');
}

public static function decodeToken($jwt, $secret)
{
return FirebaseJWT::decode($jwt, $secret, ['HS256']);
return FirebaseJWT::decode($jwt, new Key($secret, 'HS256'));
}
}

0 comments on commit af83dc3

Please sign in to comment.