/**
  * Computes the logout URL for this request and specified destination URL,
  *  for both federated login App and Google Accounts App.
  *
  * @param string $destination_url The desired final destination
  *               URL for the user once logout is complete.
  *               If 'destinationURL' does not have a host specified, we will
  *               use the host from the current request.
  *
  * @return string Logout URL.
  *
  * @throws UsersException If there was a problem using the Users service.
  */
 public static function createLogoutURL($destination_url)
 {
     $req = new CreateLogoutURLRequest();
     $resp = new CreateLogoutURLResponse();
     $req->setDestinationUrl($destination_url);
     try {
         ApiProxy::makeSyncCall('user', 'CreateLogoutURL', $req, $resp);
     } catch (ApplicationError $e) {
         throw self::applicationErrorToException($e, htmlspecialchars($destination_url));
     }
     return $resp->getLogoutUrl();
 }
示例#2
0
 /**
  * Computes the logout URL for this request and specified destination URL,
  *  for both federated login App and Google Accounts App.
  *
  * @param string $destinationURL String that is the desired final destination
  *               URL for the user once logout is complete.
  *               If 'destinationURL' does not have a host specified, we will
  *               use the host from the current request.
  *
  * @return string Logout URL.
  */
 public static function createLogoutURL($destinationURL, $authDomain = null)
 {
     $req = new CreateLogoutURLRequest();
     $resp = new CreateLogoutURLResponse();
     $req->setDestinationUrl($destinationURL);
     if ($authDomain !== null) {
         $req->setAuthDomain($authDomain);
     }
     try {
         ApiProxy::makeSyncCall('user', 'CreateLogoutURL', $req, $resp);
     } catch (ApplicationError $e) {
         if ($e->getApplicationError() === ErrorCode::REDIRECT_URL_TOO_LONG) {
             throw new RedirectTooLongError();
         } else {
             throw $e;
         }
     }
     return $resp->getLogoutUrl();
 }