/** * {@inheritDoc} */ public function check() { if ($code = $this->session->get()) { return $code; } if ($code = $this->cookie->get()) { return $code; } }
/** * Retrieves a token (OAuth1 token credentials or OAuth2 access * token) for the given provider, abstracting away the * differences from the user. * * @param mixed $provider * @return mixed * @throws \Cartalyst\Sentinel\Addons\Social\AccessMissingException */ protected function retrieveToken($provider) { if ($this->oauthVersion($provider) == 1) { $temporaryIdentifier = $this->request->getOAuth1TemporaryCredentialsIdentifier(); if (!$temporaryIdentifier) { throw new AccessMissingException('Missing [oauth_token] parameter (used for OAuth1 temporary credentials identifier).'); } $verifier = $this->request->getOAuth1Verifier(); if (!$verifier) { throw new AccessMissingException('Missing [verifier] parameter.'); } $temporaryCredentials = $this->session->get(); $tokenCredentials = $provider->getTokenCredentials($temporaryCredentials, $temporaryIdentifier, $verifier); return $tokenCredentials; } $code = $this->request->getOAuth2Code(); if (!$code) { throw new AccessMissingException("Missing [code] parameter."); } $accessToken = $provider->getAccessToken('authorization_code', compact('code')); return $accessToken; }