本文整理汇总了PHP中Hybrid_Auth::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Hybrid_Auth::redirect方法的具体用法?PHP Hybrid_Auth::redirect怎么用?PHP Hybrid_Auth::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hybrid_Auth
的用法示例。
在下文中一共展示了Hybrid_Auth::redirect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loginBegin
/**
* {@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));
}
示例2: loginBegin
/**
* 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);
}
示例3: loginBegin
/**
* 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);
}
示例4: loginBegin
/**
* begin login step
*/
function loginBegin()
{
# redirect to Authorize url
//var_dump($this->api->getAuthorizeUrl());
//die();
Hybrid_Auth::redirect($this->api->getAuthorizeUrl());
}
示例5: loginBegin
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));
}
示例6: loginBegin
/**
* {@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);
}
示例7: loginBegin
/**
* 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);
}
示例8: loginBegin
/**
* 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);
}
}
示例9: loginBegin
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));
}
示例10: loginBegin
/**
* 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);
}
示例11: loginBegin
/**
* 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());
}
示例12: loginBegin
/**
* 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));
}
示例13: loginBegin
/**
* 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));
}
示例14: loginBegin
/**
* 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));
}
示例15: loginBegin
/**
* 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);
}