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

ok does reshuffling the order of all this stuff work

Changed files
+15 -19
+15 -19
index.php
···
});
Flight::route('/login', function(): void {
+
$username = $_GET['username'];
+
$bskyToucher = new BskyToucher();
+
$userInfo = $bskyToucher->getUserInfo($username);
+
if (!$userInfo) die(1);
+
$pds = $userInfo->pds;
$options = new OAuthOptions([
'key' => 'https://'.SITE_DOMAIN.CLIENT_ID,
'secret' => CLIENT_SECRET,
···
]);
$http = new React\Http\Browser($connector);
$httpFactory = new HttpFactory();
-
$client = new GuzzleHttp\Client([
-
'verify' => true,
-
'headers' => [
-
'User-Agent' => USER_AGENT_STR
-
]
-
]);
-
$provider = new BskyProvider($options, $client, $httpFactory, $httpFactory, $httpFactory);
-
$name = $provider->getName();
-
$username = $_GET['username'];
-
$bskyToucher = new BskyToucher();
-
$userInfo = $bskyToucher->getUserInfo($username);
-
if (!$userInfo) die(1);
-
$pds = $userInfo->pds;
-
$provider->setPds($pds);
$token_builder = Builder::new(new JoseEncoder(), ChainedFormatter::default());
$algorithm = new Sha256();
$signing_key = InMemory::file(CERT_PATH);
···
->permittedFor('did:web:'.str_replace("/", "", str_replace("https://", "", $pds)))
->issuedAt($now)
->getToken($algorithm, $signing_key);
-
print_r($token->toString());
-
-
$client->setDefaultOption('headers', [
-
'User-Agent' => USER_AGENT_STR,
-
'Authorization' => 'Bearer: '.$token->toString()
+
$client = new GuzzleHttp\Client([
+
'verify' => true,
+
'headers' => [
+
'User-Agent' => USER_AGENT_STR,
+
'Authorization' => 'Bearer: '.$token->toString()
+
]
]);
+
$provider = new BskyProvider($options, $client, $httpFactory, $httpFactory, $httpFactory);
+
$provider->setPds($pds);
+
$name = $provider->getName();
+
if (isset($_GET['login']) && $_GET['login'] === $name) {
$auth_url = $provider->getAuthorizationUrl();
header('Location: '.$auth_url);