···
Flight::set('frontpageFeed', FRONTPAGE_FEED);
Flight::set('defaultRelay', DEFAULT_RELAY);
Flight::set('userAuth', array_key_exists('sbs_'.SITE_DOMAIN, $_SESSION) ? $_SESSION['sbs_'.SITE_DOMAIN] : null);
Flight::set('flight.log_errors', false);
Flight::set('flight.handle_errors', false);
Flight::set('flight.content_length', false);
···
Flight::route('/login', function(): void {
-
if (!array_key_exists('username', $_GET)) {
-
$latte = new Latte\Engine;
-
$latte->render('./templates/login.latte', array_merge(Flight::get('standardParams'), [
-
'ogtitle' => SITE_TITLE." | login",
-
'ogurl' => 'https://'.SITE_DOMAIN.'/login'
$username = $_GET['username'];
$bskyToucher = new BskyToucher();
$userInfo = $bskyToucher->getUserInfo($username);
···
$provider = new BskyProvider($options, $client, $httpFactory, $httpFactory, $httpFactory);
$name = $provider->getName();
-
echo 'get access token:';
-
print_r($storage->hasAccessToken($name));
if (isset($_GET['login']) && $_GET['login'] === $name) {
$auth_url = $provider->getAuthorizationUrl([
'client_assertion_type' => 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
···
header('Location: '.$auth_url);
-
} else if (isset($_GET['code'])) {
$storage->storeAccessToken($_GET['code'], $name);
header('Location: https://'.SITE_DOMAIN);
} else if (isset($_GET['error'])) {
···
Flight::set('frontpageFeed', FRONTPAGE_FEED);
Flight::set('defaultRelay', DEFAULT_RELAY);
Flight::set('userAuth', array_key_exists('sbs_'.SITE_DOMAIN, $_SESSION) ? $_SESSION['sbs_'.SITE_DOMAIN] : null);
+
Flight::set('userPds', array_key_exists('sbs_'.SITE_DOMAIN.'_pds', $_SESSION) ? $_SESSION['sbs_'.SITE_DOMAIN.'_pds'] : null);
+
Flight::set('userInfo', array_key_exists('sbs_'.SITE_DOMAIN.'_userinfo', $_SESSION) ? $_SESSION['sbs_'.SITE_DOMAIN.'_userinfo'] : null);
Flight::set('flight.log_errors', false);
Flight::set('flight.handle_errors', false);
Flight::set('flight.content_length', false);
···
Flight::route('/login', function(): void {
$username = $_GET['username'];
$bskyToucher = new BskyToucher();
$userInfo = $bskyToucher->getUserInfo($username);
···
$provider = new BskyProvider($options, $client, $httpFactory, $httpFactory, $httpFactory);
$name = $provider->getName();
if (isset($_GET['login']) && $_GET['login'] === $name) {
$auth_url = $provider->getAuthorizationUrl([
'client_assertion_type' => 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
···
header('Location: '.$auth_url);
+
} else if (isset($_GET['code'], $_GET['iss'])) {
$storage->storeAccessToken($_GET['code'], $name);
+
$_SESSION['sbs_'.SITE_DOMAIN.'_pds'] = $_GET['iss'];
+
$_SESSION['sbs_'.SITE_DOMAIN.'_userinfo'] = $bskyToucher->getUserInfo()
header('Location: https://'.SITE_DOMAIN);
} else if (isset($_GET['error'])) {
+
$latte = new Latte\Engine;
+
$latte->render('./templates/login.latte', array_merge(Flight::get('standardParams'), [
+
'ogtitle' => SITE_TITLE." | login",
+
'ogurl' => 'https://'.SITE_DOMAIN.'/login'