diff --git a/resources/views/errors/401.blade.php b/resources/views/errors/401.blade.php
deleted file mode 100644
index c1e9613..0000000
--- a/resources/views/errors/401.blade.php
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
- 401 – Accès non autorisé
-
-
-
-
-
401
-
Accès non autorisé
-
{{ $exception->getMessage() ?: 'Vous n\'êtes pas autorisé à accéder à cette ressource.' }}
-
-
-
diff --git a/src/Http/Controllers/DelegateAuthController.php b/src/Http/Controllers/DelegateAuthController.php
index 8707c68..64ca8b5 100644
--- a/src/Http/Controllers/DelegateAuthController.php
+++ b/src/Http/Controllers/DelegateAuthController.php
@@ -49,29 +49,14 @@ class DelegateAuthController extends Controller
private function decryptToken(string $token): ?array
{
- if (!str_contains($token, ".")) {
- return null;
- }
-
- [$ivB64, $encrypted] = explode(".", $token, 2);
-
- $iv = base64_decode($ivB64, strict: true);
- $key = substr(
- hash("sha256", config("delegate-auth.encrypt_key"), binary: true),
+ $data = base64_decode(urldecode($token));
+ $payload = openssl_decrypt(
+ substr($data, 16),
+ "AES-256-CBC",
+ config("delegate.encrypt_key"),
0,
- 32,
+ substr($data, 0, 16),
);
-
- if ($iv === false || strlen($iv) !== 16) {
- return null;
- }
-
- $payload = openssl_decrypt($encrypted, "AES-256-CBC", $key, 0, $iv);
-
- if ($payload === false) {
- return null;
- }
-
$data = json_decode($payload, associative: true);
return is_array($data) ? $data : null;