HTML and CSS Reference
In-Depth Information
* This method will be different for each OAuth authorized service,
* so it will need to be defined in the child class for the service.
abstract protected function load_user_profile_image();
each of these methods will be covered in detail as they're defined. in a nutshell, these are all the methods
required to complete the OAuth workflow described in the section “OAuth developer Workflow” earlier in
this chapter.
get_login_uri() & get_access_token_uri()
With the class skeleton defined, let's start with the required endpoints for authorization and token generation, and
define get_login_uri() and get_access_token_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( )
$state = uniqid(mt_rand(10000,99999), TRUE);
$_SESSION['state'] = $state;
return $this->service_auth_endpoint
. '?client_id=' . $this->client_id
. '&redirect_uri=' . urlencode($this->client_auth_endpoint)
. '&scope=' . $this->scope
. '&state=' . $state;
protected function get_access_token_uri( $code=NULL )
return $this->service_token_endpoint
. '?client_id=' . $this->client_id
Search WWH ::

Custom Search