friendship ended with social-app. php is my new best friend

add session store stuff

Changed files
+6 -8
lib
+5 -8
index.php
···
use Matrix\Async;
use GuzzleHttp\Psr7\HttpFactory;
use chillerlan\OAuth\OAuthOptions;
+
use chillerlan\OAuth\Storage\SessionStorage;
use DateTimeImmutable;
use Lcobucci\JWT\Token\Builder;
use Lcobucci\JWT\Encoding\ChainedFormatter;
···
'secret' => CLIENT_SECRET,
'callbackURL' => 'https://'.SITE_DOMAIN.'/login',
'sessionStart' => true,
+
'sessionStorageVar' => 'sbs_'.SITE_DOMAIN
]);
$connector = new React\Socket\Connector([
'dns' => '1.1.1.1'
···
die(1);
} else if (isset($_GET['code'], $_GET['state'])) {
$token = $provider->getAccessToken($_GET['code'], $_GET['state']);
-
-
// save the token in a permanent storage
-
// [...]
-
-
// access granted, redirect
-
header('Location: ?granted='.$name);
+
$storage = new SessionStorage($options);
+
$storage->storeAccessToken($token, $name);
+
header('Location: https://'.SITE_DOMAIN);
die(1);
} else if (isset($_GET['granted']) && $_GET['granted'] === $name) {
die(1);
···
'ogurl' => 'https://'.SITE_DOMAIN.'/login'
]));
});
-
-
// https://shimaenaga.veryroundbird.house/oauth/authorize?client_id=https%3A%2F%2Ftangled.org%2Foauth%2Fclient-metadata.json&request_uri=urn%3Aietf%3Aparams%3Aoauth%3Arequest_uri%3Areq-2399ff42af66498132ebf8de809254b7
Flight::route('/createaccount', function(): void {
$latte = new Latte\Engine;
+1
lib/bskyToucher.php
···
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Fusonic\OpenGraph\Consumer;
+
use chillerlan\OAuth\Storage\SessionStorage;
class BskyToucher {
private $bskyApiBase = 'https://public.api.bsky.app/xrpc/';