1. Go to this page and download the library: Download lorenzoferrarajr/lfj-opauth library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// [...]
class AuthController extends AbstractActionController
{
public function redirectAndReturnAction()
{
// if user is not logged in
if (!$this->auth()->hasIdentity())
{
$provider = $this->params()->fromRoute('provider');
$oauth_callback = $this->params()->fromRoute('oauth_callback');
$opauth_service = $this->getServiceLocator()->get('opauth_service');
// set custom login and callback routes
$opauth_service->setLoginUrlName('custom_lfjopauth_login');
$opauth_service->setCallbackUrlName('custom_lfjopauth_callback');
return $opauth_service->redirect($provider, $oauth_callback);
}
return $this->redirect()->toRoute('somewhere_over_the_rainbow');
}
public function callbackAction()
{
// if user is not logged in
if (!$this->auth()->hasIdentity())
{
$provider = $this->params()->fromRoute('provider');
$opauth_service = $this->getServiceLocator()->get('opauth_service');
// set custom login and callback routes
$opauth_service->setLoginUrlName('custom_lfjopauth_login');
$opauth_service->setCallbackUrlName('custom_lfjopauth_callback');
$opauth_service->callback($provider);
}
return $this->redirect()->toRoute('somewhere_else_over_the_rainbow');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.