Skip to content

Commit

Permalink
Removed functionality for retrieving facebook access token #922
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors Keuninkx committed Mar 29, 2024
1 parent d5c00d0 commit f68b310
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
28 changes: 0 additions & 28 deletions app/src/User/AuthApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,32 +89,4 @@ public function verifyTwitter($clientId, $clientSecret, $token, $verifier)
}
return false;
}

/**
* Send Facebook verification code to the API to log us in
*
* @param string $clientId OAuth client ID
* @param string $clientSecret OAuth client secret
* @param string $code Code parameter from Facebook login
*/
public function verifyFacebook($clientId, $clientSecret, $code)
{
$url = $this->baseApiUrl . '/v2.1/facebook/token';
$params = [
'client_id' => $clientId,
'client_secret' => $clientSecret,
'code' => $code,
];

list($status, $result, $headers) = $this->apiPost($url, $params);
if ($result) {
$data = json_decode($result);
if ($data) {
if (isset($data->access_token)) {
return $data;
}
}
}
return false;
}
}
22 changes: 0 additions & 22 deletions app/src/User/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ protected function defineRoutes(\Slim\Slim $app)
->via('GET', 'POST')->name('user-new-password');
$app->get('/user/twitter-login', [$this, 'loginWithTwitter'])->name('twitter-login');
$app->get('/user/twitter-access', [$this, 'accessTokenFromTwitter'])->name('twitter-callback');
$app->get('/user/facebook-access', [$this, 'accessTokenFromFacebook'])->name('facebook-callback');
$app->get('/user/:username', [$this, 'profile'])->name('user-profile');
$app->get('/user/:username/talks', [$this, 'profileTalks'])->name('user-profile-talks');
$app->get('/user/:username/events', [$this, 'profileEvents'])->name('user-profile-events');
Expand Down Expand Up @@ -836,27 +835,6 @@ public function accessTokenFromTwitter()
$this->handleLogin($result);
}

/**
* The Facebook callback URL returns here
*/
public function accessTokenFromFacebook()
{
$config = $this->application->config('oauth');
$request = $this->application->request();

// pass verification to the API so we can log in
$clientId = $config['client_id'];
$clientSecret = $config['client_secret'];

// handle incoming vars
$code = $request->get('code');

$authApi = $this->application->container->get(AuthApi::class);
$result = $authApi->verifyFacebook($clientId, $clientSecret, $code);

$this->handleLogin($result);
}

/**
* Process a user login result. If result is false, then we failed, otherwise
* update the session.
Expand Down

0 comments on commit f68b310

Please sign in to comment.