Skip to content

Commit 28524a8

Browse files
committed
firebase/php-jwt v6 compatibility
1 parent 2445df2 commit 28524a8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"require": {
1818
"silverstripe/framework": "^5",
19-
"level51/silverstripe-jwt-utils": "^0.2"
19+
"level51/silverstripe-jwt-utils": "^1.0"
2020
},
2121
"require-dev": {
2222
"phpunit/phpunit": "^5.7",

src/Controllers/ApiController.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace FullscreenInteractive\Restful\Controllers;
44

55
use Firebase\JWT\JWT;
6+
use Firebase\JWT\Key;
67
use Level51\JWTUtils\JWTUtils;
78
use SilverStripe\Control\Controller;
89
use SilverStripe\Control\HTTPResponse;
@@ -228,8 +229,11 @@ public function ensureUserLoggedIn($permissionCodes = [])
228229
{
229230
$token = JWT::decode(
230231
$this->getJwt(),
231-
Config::inst()->get(JWTUtils::class, 'secret'),
232-
['HS256']);
232+
new Key(
233+
Config::inst()->get(JWTUtils::class, 'secret'),
234+
'HS256'
235+
)
236+
);
233237

234238
$member = Member::get()->byID($token->memberId);
235239

0 commit comments

Comments
 (0)