···
$http = new React\Http\Browser($connector);
+
$httpFactory = new HttpFactory();
$client = new GuzzleHttp\Client([
'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);
+
$provider->setPds($pds);
+
$jwt_header = base64_encode(json_encode([
+
$jwt_body = base64_encode(json_encode([
+
'iss' => $userInfo->did,
+
'sub' => 'https://'.SITE_DOMAIN.CLIENT_ID,
+
'aud' => 'did:web:'.str_replace("/", str_replace("https://", $pds)),
+
'jti' => hash('sha512', bin2hex(random_bytes(256 / 2))),
+
'iat' => strtotime('now')
+
$jwt = $jwt_header.$jwt_body.base64_encode(CERT);
+
$client->setDefaultOption('headers', [
+
'User-Agent' => USER_AGENT_STR,
+
'Authorization' => 'Bearer: '.$jwt
if (isset($_GET['login']) && $_GET['login'] === $name) {
+
$auth_url = $provider->getAuthorizationUrl();
+
header('Location: '.$auth_url);
} else if (isset($_GET['code'], $_GET['state'])) {
$token = $provider->getAccessToken($_GET['code'], $_GET['state']);