Example #1
  * Handle the creation of auth code.
  * This belongs in a separate factory, but to keep it simple, I'm just
  * keeping it here.
  * @param IOAuth2Client $client      Client related to the access token.
  * @param mixed         $data
  * @param string        $redirectUri An absolute URI to which the authorization server will redirect the user-agent to when the end-user authorization step is completed.
  * @param string        $scope       (optional) Scopes to be stored in space-separated string.
  * @return string
  * @ingroup oauth2_section_4
 private function createAuthCode(IOAuth2Client $client, $data, $redirectUri, $scope = null)
     $code = $this->genAuthCode();
     $this->storage->createAuthCode($code, $client, $data, $redirectUri, time() + $this->getVariable(self::CONFIG_AUTH_LIFETIME), $scope);
     return $code;