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

add session store stuff

Changed files
+6 -8
lib
+5 -8
index.php
··· 19 19 use Matrix\Async; 20 20 use GuzzleHttp\Psr7\HttpFactory; 21 21 use chillerlan\OAuth\OAuthOptions; 22 + use chillerlan\OAuth\Storage\SessionStorage; 22 23 use DateTimeImmutable; 23 24 use Lcobucci\JWT\Token\Builder; 24 25 use Lcobucci\JWT\Encoding\ChainedFormatter; ··· 197 198 'secret' => CLIENT_SECRET, 198 199 'callbackURL' => 'https://'.SITE_DOMAIN.'/login', 199 200 'sessionStart' => true, 201 + 'sessionStorageVar' => 'sbs_'.SITE_DOMAIN 200 202 ]); 201 203 $connector = new React\Socket\Connector([ 202 204 'dns' => '1.1.1.1' ··· 237 239 die(1); 238 240 } else if (isset($_GET['code'], $_GET['state'])) { 239 241 $token = $provider->getAccessToken($_GET['code'], $_GET['state']); 240 - 241 - // save the token in a permanent storage 242 - // [...] 243 - 244 - // access granted, redirect 245 - header('Location: ?granted='.$name); 242 + $storage = new SessionStorage($options); 243 + $storage->storeAccessToken($token, $name); 244 + header('Location: https://'.SITE_DOMAIN); 246 245 die(1); 247 246 } else if (isset($_GET['granted']) && $_GET['granted'] === $name) { 248 247 die(1); ··· 258 257 'ogurl' => 'https://'.SITE_DOMAIN.'/login' 259 258 ])); 260 259 }); 261 - 262 - // 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 263 260 264 261 Flight::route('/createaccount', function(): void { 265 262 $latte = new Latte\Engine;
+1
lib/bskyToucher.php
··· 25 25 use Psr\Http\Message\RequestInterface; 26 26 use Psr\Http\Message\ResponseInterface; 27 27 use Fusonic\OpenGraph\Consumer; 28 + use chillerlan\OAuth\Storage\SessionStorage; 28 29 29 30 class BskyToucher { 30 31 private $bskyApiBase = 'https://public.api.bsky.app/xrpc/';