private function buildTokenKey() { $tokenKey = new TokenKey(); // need to URLDecode so when comparing with the ProviderKey it goes thought $tokenKey->setGadgetUri(urldecode($this->authToken->getAppUrl())); $tokenKey->setModuleId($this->authToken->getModuleId()); $tokenKey->setServiceName($this->requestParams->getServiceName()); $tokenKey->setTokenName($this->requestParams->getTokenName()); // At some point we might want to let gadgets specify whether to use OAuth // for the owner, the viewer, or someone else. For now always using the // owner identity seems reasonable. $tokenKey->setUserId($this->authToken->getOwnerId()); return $tokenKey; }
/** * * @return TokenKey */ private function buildTokenKey() { $tokenKey = new TokenKey(); // need to URLDecode so when comparing with the ProviderKey it goes thought $tokenKey->setGadgetUri(urldecode($this->authToken->getAppUrl())); $tokenKey->setModuleId($this->authToken->getModuleId()); $tokenKey->setAppId($this->authToken->getAppId()); $tokenKey->setServiceName($this->requestParams->getServiceName()); $tokenKey->setTokenName($this->requestParams->getTokenName()); // We should always use the current viewer id as a token key. Using the owner id // would mean, that a private access token (with possible write access to the api) // could be accessable to other viewers that are visiting the gadget of another // owner $tokenKey->setUserId($this->authToken->getViewerId()); return $tokenKey; }