/**
  *
  * @param oauthCrypter used to encrypt transient information we store on the
  *        client.
  * @param authToken user's gadget security token
  * @param params OAuth fetch parameters sent from makeRequest
  * @param tokenStore storage for long lived tokens.
  */
 public function __construct($tokenStore, $oauthCrypter, $fetcher, $authToken, OAuthRequestParams $params)
 {
     $this->fetcher = $fetcher;
     $this->oauthCrypter = $oauthCrypter;
     $this->authToken = $authToken;
     $this->bypassSpecCache = $params->getBypassSpecCache();
     $this->requestParams = $params;
     $this->newClientState = null;
     $this->aznUrl = null;
     $this->error = null;
     $this->errorText = null;
     $origClientState = $params->getOrigClientState();
     if ($origClientState != null && strlen($origClientState) > 0) {
         try {
             $this->origClientState = $this->oauthCrypter->unwrap($origClientState, self::$CLIENT_STATE_MAX_AGE_SECS);
         } catch (BlobCrypterException $e) {
             // Probably too old, pretend we never saw it at all.
         }
     }
     if ($this->origClientState == null) {
         $this->origClientState = array();
     }
     $this->tokenStore = $tokenStore;
 }