Example #1
0
 /**
  * Handle the request.
  *
  * @return  void
  *
  * @since   1.0
  */
 public function execute()
 {
     // Verify that we have an OAuth 2.0 application.
     $this->initialise();
     // Generate temporary credentials for the client.
     $credentials = new ROauth2Credentials($this->request);
     $credentials->load();
     // Getting the client object
     $client = $this->fetchClient($this->request->client_id);
     // Ensure the credentials are authorised.
     if ($credentials->getType() !== ROauth2Credentials::TOKEN) {
         $this->respondError(400, 'invalid_request', 'The token is not for a valid credentials yet.');
     }
     // Ensure the credentials are authorised.
     if (!$credentials->sign()) {
         $this->respondError(400, 'unauthorized_client', 'Invalid sign');
     }
     // Load the JUser class on application for this client
     $this->app->loadIdentity($client->_identity);
 }