/** * {@inheritdoc} */ public function loginBegin() { // Initiate the Reverse Auth flow; cf. https://dev.twitter.com/docs/ios/using-reverse-auth if (isset($_REQUEST['reverse_auth']) && $_REQUEST['reverse_auth'] == 'yes') { $stage1 = $this->api->signedRequest($this->api->request_token_url, 'POST', array('x_auth_mode' => 'reverse_auth')); if ($this->api->http_code != 200) { throw new Exception("Authentication failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus($this->api->http_code), 5); } $responseObj = array('x_reverse_auth_parameters' => $stage1, 'x_reverse_auth_target' => $this->config["keys"]["key"]); $response = json_encode($responseObj); header("Content-Type: application/json", true, 200); echo $response; die; } $tokens = $this->api->requestToken($this->endpoint); // request tokens as received from provider $this->request_tokens_raw = $tokens; // check the last HTTP status code returned if ($this->api->http_code != 200) { throw new Exception("Authentication failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus($this->api->http_code), 5); } if (!isset($tokens["oauth_token"])) { throw new Exception("Authentication failed! {$this->providerId} returned an invalid oauth token.", 5); } $this->token("request_token", $tokens["oauth_token"]); $this->token("request_token_secret", $tokens["oauth_token_secret"]); // redirect the user to the provider authentication url with force_login if (isset($this->config['force_login']) && $this->config['force_login'] || isset($this->config['force']) && $this->config['force'] === true) { Hybrid_Auth::redirect($this->api->authorizeUrl($tokens, array('force_login' => true))); } // else, redirect the user to the provider authentication url Hybrid_Auth::redirect($this->api->authorizeUrl($tokens)); }
/** * begin login step * * simply call Facebook::require_login(). */ function loginBegin() { $parameters = array("scope" => $this->scope, "redirect_uri" => $this->endpoint, "display" => "page"); $optionals = array("scope", "redirect_uri", "display", "auth_type"); foreach ($optionals as $parameter) { if (isset($this->config[$parameter]) && !empty($this->config[$parameter])) { $parameters[$parameter] = $this->config[$parameter]; //If the auth_type parameter is used, we need to generate a nonce and include it as a parameter if ($parameter == "auth_type") { $nonce = md5(uniqid(mt_rand(), true)); $parameters['auth_nonce'] = $nonce; Hybrid_Auth::storage()->set('fb_auth_nonce', $nonce); } } } if (isset($this->config['force']) && $this->config['force'] === true) { $parameters['auth_type'] = 'reauthenticate'; $parameters['auth_nonce'] = md5(uniqid(mt_rand(), true)); Hybrid_Auth::storage()->set('fb_auth_nonce', $parameters['auth_nonce']); } // get the login url $url = $this->api->getLoginUrl($parameters); // redirect to facebook Hybrid_Auth::redirect($url); }
/** * begin login step * * simply call Facebook::require_login(). */ function loginBegin() { // get the login url $url = $this->api->getLoginUrl(array('scope' => $this->scope, 'display' => $this->display, 'redirect_uri' => $this->endpoint)); // redirect to facebook Hybrid_Auth::redirect($url); }
/** * begin login step */ function loginBegin() { # redirect to Authorize url //var_dump($this->api->getAuthorizeUrl()); //die(); Hybrid_Auth::redirect($this->api->getAuthorizeUrl()); }
function loginBegin() { $parameters = array('scope' => isset($this->config['scope']) ? $this->config['scope'] : $this->scope, 'response_type' => 'token', 'client_id' => $this->api->client_id, 'redirect_uri' => $this->api->redirect_uri, 'state' => isset($this->config['state']) ? $this->config['state'] : ''); if (is_array($parameters['scope'])) { $parameters['scope'] = implode(',', $parameters['scope']); } Hybrid_Auth::redirect($this->api->authorizeUrl($parameters)); }
/** * {@inheritdoc} */ function loginBegin() { $this->endpoint = $this->params['login_done']; $helper = $this->api->getRedirectLoginHelper(); // Use re-request, because this will trigger permissions window if not all permissions are granted. $url = $helper->getReRequestUrl($this->endpoint, $this->scope); // Redirect to Facebook Hybrid_Auth::redirect($url); }
/** * begin login step * * simply call Renren::require_login(). */ function loginBegin() { $state = uniqid(null, true); $this->api->setPersistentData('state', $state); // get the login url $url = $this->api->getAuthorizeURL($this->endpoint, 'code', $state, "page"); // redirect to Renren Hybrid_Auth::redirect($url); }
/** * begin login step */ function loginBegin() { try { $this->api->setRedirectURI($this->endpoint); $url = $this->api->getAuthorizationURL(); Hybrid_Auth::redirect($url); } catch (ViadeoException $e) { throw new Exception("Authentication failed! An error occurred during {$this->providerId} authentication.", 5); } }
function loginBegin() { $parameters = array(); $optionals = array("redirect_uri"); foreach ($optionals as $parameter) { if (isset($this->config[$parameter]) && !empty($this->config[$parameter])) { $parameters[$parameter] = $this->config[$parameter]; } } Hybrid_Auth::redirect($this->api->authorizeUrl($parameters)); }
/** * begin login step * * simply call MyHeritage::require_login(). */ function loginBegin() { // if we have extra perm if (isset($this->config["scope"]) && !empty($this->config["scope"])) { $this->scope = $this->scope . ", " . $this->config["scope"]; } // get the login url $url = $this->api->getLoginUrl(array('scope' => $this->scope, 'redirect_uri' => $this->endpoint)); // redirect to MyHeritage Hybrid_Auth::redirect($url); }
/** * begin login step */ function loginBegin() { if (empty($this->openidIdentifier)) { throw new Exception("OpenID adapter require the identity provider identifier 'openid_identifier' as an extra parameter.", 4); } $this->api->identity = $this->openidIdentifier; $this->api->returnUrl = $this->endpoint; $this->api->required = array('namePerson/first', 'namePerson/last', 'namePerson/friendly', 'namePerson', 'contact/email', 'birthDate', 'birthDate/birthDay', 'birthDate/birthMonth', 'birthDate/birthYear', 'person/gender', 'pref/language', 'contact/postalCode/home', 'contact/city/home', 'contact/country/home', 'media/image/default'); # redirect the user to the provider authentication url Hybrid_Auth::redirect($this->api->authUrl()); }
/** * begin login step */ function loginBegin() { $parameters = array("scope" => $this->scope, "access_type" => "offline"); $optionals = array("scope", "access_type", "redirect_uri", "approval_prompt", "hd"); foreach ($optionals as $parameter) { if (isset($this->config[$parameter]) && !empty($this->config[$parameter])) { $parameters[$parameter] = $this->config[$parameter]; } } Hybrid_Auth::redirect($this->api->authorizeUrl($parameters)); }
/** * begin login step */ function loginBegin() { if (!isset($this->state)) { $this->state = md5(uniqid(rand(), TRUE)); } $this->saveState($this->state); $extra_params['state'] = $this->state; if (isset($this->scope)) { $extra_params['scope'] = $this->scope; } Hybrid_Auth::redirect($this->api->authorizeUrl($extra_params)); }
/** * begin login step */ function loginBegin() { if (!isset($this->state)) { $this->state = md5(uniqid(rand(), TRUE)); } $session_var_name = 'state_' . $this->api->client_id; $_SESSION[$session_var_name] = $this->state; $extra_params['state'] = $this->state; if (isset($this->scope)) { $extra_params['scope'] = $this->scope; } Hybrid_Auth::redirect($this->api->authorizeUrl($extra_params)); }
/** * begin login step * * simply call Facebook::require_login(). */ function loginBegin() { $parameters = array("scope" => $this->scope, "redirect_uri" => $this->endpoint, "display" => "page"); $optionals = array("scope", "redirect_uri", "display"); foreach ($optionals as $parameter) { if (isset($this->config[$parameter]) && !empty($this->config[$parameter])) { $parameters[$parameter] = $this->config[$parameter]; } } // get the login url $url = $this->api->getLoginUrl($parameters); Hybrid_Auth::redirect($url); }
/** * begin login step */ function loginBegin() { // send a request for a LinkedIn access token $response = $this->api->retrieveTokenRequest(); if (isset($response['success']) && $response['success'] === TRUE) { $this->token("oauth_token", $response['linkedin']['oauth_token']); $this->token("oauth_token_secret", $response['linkedin']['oauth_token_secret']); # redirect user to LinkedIn authorisation web page Hybrid_Auth::redirect(LINKEDIN::_URL_AUTH . $response['linkedin']['oauth_token']); } else { throw new Exception("Authentication failed! {$this->providerId} returned an invalid Token.", 5); } }
/** * begin login step */ function loginBegin() { $this->api = new phpVimeo($this->config["keys"]["key"], $this->config["keys"]["secret"]); // Get a new request token $tokz = $this->api->getRequestToken($this->endpoint); if (!isset($tokz["oauth_token"])) { throw new Exception("Authentication failed! {$this->providerId} returned an invalid Request Token.", 5); } $this->token("request_token", $tokz['oauth_token']); $this->token("request_token_secret", $tokz['oauth_token_secret']); # Build authorize link & redirect user to vimeo authorisation web page Hybrid_Auth::redirect($this->api->getAuthorizeUrl($tokz['oauth_token'], 'write')); }
/** * begin login step */ function loginBegin() { if (empty($this->openidIdentifier)) { throw new Exception("OpenID adapter require the identity provider identifier 'openid_identifier' as an extra parameter.", 4); } $this->api->identity = $this->openidIdentifier; $this->api->returnUrl = $this->endpoint; $this->api->required = array('namePerson/prefix', 'namePerson/first', 'namePerson/last', 'namePerson/middle', 'namePerson/suffix', 'namePerson/friendly', 'person/guid', 'birthDate/birthYear', 'birthDate/birthMonth', 'birthDate/birthday', 'gender', 'language/pref', 'contact/phone/default', 'contact/phone/home', 'contact/phone/business', 'contact/phone/cell', 'contact/phone/fax', 'contact/postaladdress/home', 'contact/postaladdressadditional/home', 'contact/city/home', 'contact/state/home', 'contact/country/home', 'contact/postalcode/home', 'contact/postaladdress/business', 'contact/postaladdressadditional/business', 'contact/city/business', 'contact/state/business', 'contact/country/business', 'contact/postalcode/business', 'company/name', 'company/title'); $this->api->optional = array(); array('namePerson/prefix', 'namePerson/first', 'namePerson/last', 'namePerson/middle', 'namePerson/suffix', 'namePerson/friendly', 'person/guid', 'birthDate/birthYear', 'birthDate/birthMonth', 'birthDate/birthday', 'gender', 'language/pref', 'contact/phone/default', 'contact/phone/home', 'contact/phone/business', 'contact/phone/cell', 'contact/phone/fax', 'contact/postaladdress/home', 'contact/postaladdressadditional/home', 'contact/city/home', 'contact/state/home', 'contact/country/home', 'contact/postalcode/home', 'contact/postaladdress/business', 'contact/postaladdressadditional/business', 'contact/city/business', 'contact/state/business', 'contact/country/business', 'contact/postalcode/business', 'company/name', 'company/title'); # redirect the user to the provider authentication url Hybrid_Auth::redirect($this->api->authUrl()); }
function loginBegin() { //To restrict to particular domain uncomment the following and comment the next line //$parameters = array("scope" => $this->scope, "access_type" => "offline", "hd" => "example.com"); $parameters = array("scope" => $this->scope, "access_type" => "offline"); $optionals = array("scope", "access_type", "redirect_uri", "approval_prompt", "hd"); foreach ($optionals as $parameter) { if (isset($this->config[$parameter]) && !empty($this->config[$parameter])) { $parameters[$parameter] = $this->config[$parameter]; } } Hybrid_Auth::redirect($this->api->authorizeUrl($parameters)); // redirect the user to the provider authentication url //Hybrid_Auth::redirect( $this->api->authorizeUrl( array( "scope" => $this->scope ) ) ); }
/** * {@inheritdoc} */ public function loginBegin() { $parameters = array("scope" => $this->scope, "access_type" => "offline"); $optionals = array("scope", "access_type", "redirect_uri", "approval_prompt", "hd", "state"); foreach ($optionals as $parameter) { if (isset($this->config[$parameter]) && !empty($this->config[$parameter])) { $parameters[$parameter] = $this->config[$parameter]; } if (isset($this->config["scope"]) && !empty($this->config["scope"])) { $this->scope = $this->config["scope"]; } } if (isset($this->config['force']) && $this->config['force'] === true) { $parameters['approval_prompt'] = 'force'; } Hybrid_Auth::redirect($this->api->authorizeUrl($parameters)); }
/** * begin login step */ function loginBegin() { $tokens = $this->api->requestToken($this->endpoint); // request tokens as recived from provider $this->request_tokens_raw = $tokens; // check the last HTTP status code returned if ($this->api->http_code != 200) { throw new Exception("Authentication failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus($this->api->http_code), 5); } if (!isset($tokens["oauth_token"])) { throw new Exception("Authentication failed! {$this->providerId} returned an invalid oauth token.", 5); } $this->token("request_token", $tokens["oauth_token"]); $this->token("request_token_secret", $tokens["oauth_token_secret"]); # redirect the user to the provider authentication url Hybrid_Auth::redirect($this->api->authorizeUrl($tokens)); }
/** * Begin logging in. */ function loginBegin() { // Handle the request token. $aToken = $this->api->requestToken($this->endpoint); $this->request_tokens_raw = $aToken; // The HTTP status code needs to be 201. If it's not, something is wrong. if ($this->api->http_code !== 201) { throw new Exception('Authentication failed! ' . $this->providerId . ' returned an error: ' . $this->errorMessageByStatus($this->api->http_code) . '.'); } // If we don't have an OAuth token by now, something is ABSOLUTELY wrong. if (!isset($aToken['oauth_token'])) { throw new Exception('Authentication failed! ' . $this->providerId . ' returned an invalid OAuth token.'); } $this->token('request_token', $aToken['oauth_token']); $this->token('request_token_secret', $aToken['oauth_token_secret']); // Redirect to the XING authorization URL. Hybrid_Auth::redirect($this->api->authorizeUrl($aToken)); }
/** * begin login step */ function loginBegin() { // send a request for a LinkedIn access token $response = $this->api->retrieveTokenRequest(); if (isset($response['success']) && $response['success'] === TRUE) { $this->token("oauth_token", $response['linkedin']['oauth_token']); $this->token("oauth_token_secret", $response['linkedin']['oauth_token_secret']); # redirect user to LinkedIn authorisation web page Hybrid_Auth::redirect(LINKEDIN::_URL_AUTH . $response['linkedin']['oauth_token']); } else { if (isset($response['linkedin']['oauth_problem'])) { if ($response['linkedin']['oauth_problem'] == 'timestamp_refused') { throw new Exception("Authentication failed! Your server time is not in sync with the {$this->providerId} servers. Acceptable timestamps: " . date("D, d M Y G:i:s", (int) $response['linkedin']['oauth_acceptable_timestamps']), 5); } throw new Exception("Authentication failed! {$this->providerId} returned an oauth_problem.", 5); } throw new Exception("Authentication failed! {$this->providerId} returned an invalid oauth_token", 5); } }
$error = '<b style="color:red">' . trim(strip_tags($_GET["error"])) . '</b><br /><br />'; } // if user select a provider to login with // then inlcude hybridauth config and main class // then try to authenticate te current user // finally redirect him to his profile page if (isset($_GET["provider"]) && $_GET["provider"]) { try { // create an instance for Hybridauth with the configuration file path as parameter $hybridauth = new Hybrid_Auth($config); // set selected provider name $provider = @trim(strip_tags($_GET["provider"])); // try to authenticate the selected $provider $adapter = $hybridauth->authenticate($provider); // if okey, we will redirect to user profile page $hybridauth->redirect("profile.php?provider={$provider}"); } catch (Exception $e) { // In case we have errors 6 or 7, then we have to use Hybrid_Provider_Adapter::logout() to // let hybridauth forget all about the user so we can try to authenticate again. // Display the recived error, // to know more please refer to Exceptions handling section on the userguide switch ($e->getCode()) { case 0: $error = "Unspecified error."; break; case 1: $error = "Hybriauth configuration error."; break; case 2: $error = "Provider not properly configured."; break;
/** * begin login step */ function loginBegin() { # redirect to Authorize url Hybrid_Auth::redirect($this->api->getLoginUrl($this->endpoint)); }
/** * Begin login step */ function loginBegin() { // redirect the user to the provider authentication url Hybrid_Auth::redirect($this->api->authorizeUrl()); }
/** * begin login step */ function loginBegin() { Hybrid_Auth::redirect($this->api->getLoginUrl($this->endpoint)); }
<?php // config and whatnot $config = dirname(__FILE__) . '/../../hybridauth/config.php'; require_once "../../hybridauth/Hybrid/Auth.php"; try { $hybridauth = new Hybrid_Auth($config); // logout the user from $provider $hybridauth->logoutAllProviders(); // return to login page $hybridauth->redirect("login.php"); } catch (Exception $e) { echo "<br /><br /><b>Oh well, we got an error :</b> " . $e->getMessage(); echo "<hr /><h3>Trace</h3> <pre>" . $e->getTraceAsString() . "</pre>"; }
/** * redirect the user to hauth_return_to (the callback url) */ function returnToCallbackUrl() { // get the stored callback url $callback_url = Hybrid_Auth::storage()->get("hauth_session.{$this->id}.hauth_return_to"); // remove some unneed'd stored data Hybrid_Auth::storage()->delete("hauth_session.{$this->id}.hauth_return_to"); Hybrid_Auth::storage()->delete("hauth_session.{$this->id}.hauth_endpoint"); Hybrid_Auth::storage()->delete("hauth_session.{$this->id}.id_provider_params"); // back to home Hybrid_Auth::redirect($callback_url); }
/** * begin login step */ function loginBegin() { $this->api->ExpireCookies(); Hybrid_Auth::redirect(WRAP_CONSENT_URL . "?wrap_client_id=" . WRAP_CLIENT_ID . "&wrap_callback=" . urlencode(WRAP_CALLBACK) . "&wrap_scope=WL_Profiles.View"); }