/**
  * Retrieves metadata from our persistent store.
  *
  * @throws GadgetException
  */
 protected function lookupOAuthMetadata()
 {
     $tokenKey = $this->buildTokenKey();
     $this->accessorInfo = $this->tokenStore->getOAuthAccessor($tokenKey, $this->bypassSpecCache);
     // The persistent data store may be out of sync with reality; we trust
     // the state we stored on the client to be accurate.
     $accessor = $this->accessorInfo->getAccessor();
     if (isset($this->origClientState[self::$REQ_TOKEN_KEY])) {
         $accessor->requestToken = $this->origClientState[self::$REQ_TOKEN_KEY];
         $accessor->tokenSecret = $this->origClientState[self::$REQ_TOKEN_SECRET_KEY];
     } else {
         if (isset($this->origClientState[self::$ACCESS_TOKEN_KEY])) {
             $accessor->accessToken = $this->origClientState[self::$ACCESS_TOKEN_KEY];
             $accessor->tokenSecret = $this->origClientState[self::$ACCESS_TOKEN_SECRET_KEY];
         } else {
             if ($accessor->accessToken == null && $this->requestParams->getRequestToken() != null) {
                 // We don't have an access token yet, but the client sent us a
                 // (hopefully) preapproved request token.
                 $accessor->requestToken = $this->requestParams->getRequestToken();
                 $accessor->tokenSecret = $this->requestParams->getRequestTokenSecret();
             }
         }
     }
 }