當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AbstractProvider::getAuthorizationUrl方法代碼示例

本文整理匯總了PHP中League\OAuth2\Client\Provider\AbstractProvider::getAuthorizationUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP AbstractProvider::getAuthorizationUrl方法的具體用法?PHP AbstractProvider::getAuthorizationUrl怎麽用?PHP AbstractProvider::getAuthorizationUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在League\OAuth2\Client\Provider\AbstractProvider的用法示例。


在下文中一共展示了AbstractProvider::getAuthorizationUrl方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: redirect

 /**
  * Creates a RedirectResponse that will send the user to the
  * OAuth2 server (e.g. send them to Facebook).
  *
  * @param array $scopes The scopes you want (leave empty to use default)
  * @return RedirectResponse
  */
 public function redirect(array $scopes = [])
 {
     $options = [];
     if (!empty($scopes)) {
         $options['scope'] = $scopes;
     }
     $url = $this->provider->getAuthorizationUrl($options);
     // set the state (unless we're stateless)
     if (!$this->isStateless) {
         $this->getSession()->set(self::OAUTH2_SESSION_STATE_KEY, $this->provider->getState());
     }
     return new RedirectResponse($url);
 }
開發者ID:knpuniversity,項目名稱:oauth2-client-bundle,代碼行數:20,代碼來源:OAuth2Client.php

示例2: moveToAuth

 private function moveToAuth(AbstractProvider $provider)
 {
     $authorizationUrl = $provider->getAuthorizationUrl();
     $_SESSION['oauth2state'] = $provider->getState();
     header('Location: ' . $authorizationUrl);
     exit;
 }
開發者ID:cass-project,項目名稱:cass,代碼行數:7,代碼來源:AbstractCommand.php

示例3: getAuthorizationUrl

 public function getAuthorizationUrl($options = [])
 {
     $url = parent::getAuthorizationUrl($options);
     if ($this->testMode) {
         $url .= '&sandbox=true';
     }
     return $url;
 }
開發者ID:lemonstand,項目名稱:oauth2-amazon,代碼行數:8,代碼來源:Amazon.php

示例4: getAuthorizationUrl

 public function getAuthorizationUrl($options = array())
 {
     $url = parent::getAuthorizationUrl($options);
     if (!empty($this->hostedDomain)) {
         $url .= '&' . $this->httpBuildQuery(['hd' => $this->hostedDomain]);
     }
     return $url;
 }
開發者ID:LigorioSalgado,項目名稱:Slyfer,代碼行數:8,代碼來源:Google.php

示例5: getAuthorizationUrl

 public function getAuthorizationUrl(array $options = [])
 {
     $url = parent::getAuthorizationUrl($options);
     $params = array_filter(['hd' => $this->hostedDomain, 'access_type' => $this->accessType]);
     if ($params) {
         $url .= '&' . $this->httpBuildQuery($params);
     }
     return $url;
 }
開發者ID:rmartignoni,項目名稱:oauth2-google,代碼行數:9,代碼來源:Google.php

示例6: getAuthorizationUrl

 public function getAuthorizationUrl(array $options = [])
 {
     // this one is a tough one, it's impossible to provide the scopes and state anywhere else
     // than in this options array,
     $options['state'] = $this->getState();
     if (!empty($this->scopes)) {
         $options['scope'] = $this->scopes;
     }
     return parent::getAuthorizationUrl($options);
 }
開發者ID:medialab-online,項目名稱:medialab-sdk-php,代碼行數:10,代碼來源:MedialabProvider.php

示例7: handle

 /**
  * @param Request $request
  * @return \Psr\Http\Message\ResponseInterface|RedirectResponse
  */
 public function handle(Request $request)
 {
     $redirectUri = (string) $request->getAttribute('originalUri', $request->getUri())->withQuery('');
     $this->provider = $this->getProvider($redirectUri);
     $session = $request->getAttribute('session');
     $queryParams = $request->getQueryParams();
     $code = array_get($queryParams, 'code');
     $state = array_get($queryParams, 'state');
     if (!$code) {
         $authUrl = $this->provider->getAuthorizationUrl($this->getAuthorizationUrlOptions());
         $session->set('oauth2state', $this->provider->getState());
         return new RedirectResponse($authUrl . '&display=popup');
     } elseif (!$state || $state !== $session->get('oauth2state')) {
         $session->forget('oauth2state');
         echo 'Invalid state. Please close the window and try again.';
         exit;
     }
     $this->token = $this->provider->getAccessToken('authorization_code', compact('code'));
     $owner = $this->provider->getResourceOwner($this->token);
     $identification = $this->getIdentification($owner);
     $suggestions = $this->getSuggestions($owner);
     return $this->authResponse->make($request, $identification, $suggestions);
 }
開發者ID:flarum,項目名稱:core,代碼行數:27,代碼來源:AbstractOAuth2Controller.php

示例8: getAuthorizationUrl

 public function getAuthorizationUrl($options = array())
 {
     return parent::getAuthorizationUrl(array_merge(['approval_prompt' => []], $options));
 }
開發者ID:sumitnegi933,項目名稱:Moodle_lms_New,代碼行數:4,代碼來源:Dropbox.php

示例9: testAuthorizationUrlStateParam

 public function testAuthorizationUrlStateParam()
 {
     $this->assertContains('state=XXX', $this->provider->getAuthorizationUrl(['state' => 'XXX']));
 }
開發者ID:codeforamerica,項目名稱:oakland-beta,代碼行數:4,代碼來源:AbstractProviderTest.php

示例10: getAuthorizationUrl

 public function getAuthorizationUrl($options = [])
 {
     $url = parent::getAuthorizationUrl($options);
     $url .= '&type=web_server';
     return $url;
 }
開發者ID:uberboom,項目名稱:oauth2-basecamp,代碼行數:6,代碼來源:Basecamp.php

示例11: getAuthorizationUrl

 public function getAuthorizationUrl($options = [])
 {
     return parent::getAuthorizationUrl(['state' => $this->getState()]) . '&company_id=' . $this->companyId;
 }
開發者ID:shiftplanning,項目名稱:humanity-php-sdk,代碼行數:4,代碼來源:Humanity.php

示例12: getAuthorizationUrl

 public function getAuthorizationUrl($options = array())
 {
     $url = parent::getAuthorizationUrl($options);
     return $url;
 }
開發者ID:scbd,項目名稱:oath2ProviderSCBD,代碼行數:5,代碼來源:scbd.php

示例13: getAuthorizationUrl

 /**
  * {@inheritDoc}
  */
 public function getAuthorizationUrl($options = [])
 {
     $url = parent::getAuthorizationUrl();
     // This is required as an option to be given a refresh token
     if (isset($options["duration"])) {
         $url .= "&duration={$options['duration']}";
     }
     return $url;
 }
開發者ID:rtheunissen,項目名稱:oauth2-reddit,代碼行數:12,代碼來源:Reddit.php


注:本文中的League\OAuth2\Client\Provider\AbstractProvider::getAuthorizationUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。