Skip to content

Commit 0e318b5

Browse files
committed
Issue #503: OAuth2 token invalidated on Composer install/update
Signed-off-by: alexmerlin <[email protected]>
1 parent 3f2e57f commit 0e318b5

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

bin/generate-oauth2-keys.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$files = [
6+
'./data/oauth/encryption.key',
7+
'./data/oauth/private.key',
8+
'./data/oauth/public.key',
9+
];
10+
11+
foreach ($files as $file) {
12+
if (! file_exists($file)) {
13+
return include './vendor/mezzio/mezzio-authentication-oauth2/bin/generate-oauth2-keys';
14+
}
15+
}
16+
17+
echo 'OAuth2 keys already exist. Skipping...' . PHP_EOL;
18+
return 0;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"development-enable": "laminas-development-mode enable",
130130
"development-status": "laminas-development-mode status",
131131
"post-update-cmd": [
132-
"php ./vendor/bin/generate-oauth2-keys",
132+
"php ./bin/generate-oauth2-keys.php",
133133
"php ./bin/composer-post-install-script.php"
134134
],
135135
"serve": "php -S 0.0.0.0:8080 -t public/",

0 commit comments

Comments
 (0)