You are here

protected function ApiAuthorize::getOauthProvider in FormAssembly 8

Configures and returns an OAuth provider for FormAssembly.

Return value

\Fathershawn\OAuth2\Client\Provider\FormAssembly The configured provider.

2 calls to ApiAuthorize::getOauthProvider()
ApiAuthorize::authorize in src/ApiAuthorize.php
Use the auth code provided by FormAssembly to authorize the application.
ApiAuthorize::getToken in src/ApiAuthorize.php
Retrieve an active access_token.

File

src/ApiAuthorize.php, line 150

Class

ApiAuthorize
Service class for FormAssembly API: Handles authorization.

Namespace

Drupal\formassembly

Code

protected function getOauthProvider() {
  $credentials = $this->keyService
    ->getOauthKeys();
  $provider = new OauthProvider([
    'clientId' => $credentials['cid'],
    'clientSecret' => $credentials['secret'],
    'redirectUri' => Url::fromRoute('fa_form.authorize.store', [], [
      'absolute' => TRUE,
    ])
      ->toString(TRUE)
      ->getGeneratedUrl(),
    'baseUrl' => $this
      ->getUrl('base')
      ->toString(TRUE)
      ->getGeneratedUrl(),
  ]);
  return $provider;
}