HTML and CSS Reference
In-Depth Information
. '&redirect_uri=' . urlencode($this->client_auth_endpoint)
. '&client_secret=' . $this->client_secret
. '&code=' . $code;
protected function save_access_token( ) {...}
protected function request_uri( ) {...}
abstract protected function load_user_data();
abstract protected function load_user_profile_image();
the first thing the get_login_uri() method does is generate a unique string to be passed as the state
parameter, which will be used to verify that the authorization request is genuine. this is stored in the session as
well for later reference.
After that, we concatenate the $service_auth_endpoint with the required parameters. in order to avoid
encoding issues, the $client_auth_endpoint value is run through urlencode() first.
Once assembled, the authorization request, or login, uRi is returned.
this same process is followed for get_access_token_uri() , with two small differences: 1) the state parameter
is not used, and 2) the client_secret parameter is added. it also accepts a parameter, $code , which is sent
back from the service provider. We'll cover how we're obtaining that value in the next section.
save_access_token() and request_uri()
in order to load and save the generated token, let's define save_access_token() and request_uri() :
abstract class RWA_OAuth
public $service_auth_endpoint, $service_token_endpoint, $scope,
$client_id, $client_secret, $client_auth_endpoint,
$id, $username, $name, $email, $profile_image;
protected $logged_in = FALSE,
$access_token = FALSE;
public function __construct( ) {...}
public function check_login( ) {...}
public function is_logged_in( ) {...}
public function logout( ) {...}
public function get_login_uri( ) {...}
protected function get_access_token_uri( ) {...}
Search WWH ::

Custom Search