You are here

public function FormAssemblyKeyService::getOauthKeys in FormAssembly 8

Get the oauth credentials.

Return value

string The value of the configured key.

File

src/FormAssemblyKeyService.php, line 69

Class

FormAssemblyKeyService
This service retrieves the appropriate api key from the configured provider.

Namespace

Drupal\formassembly

Code

public function getOauthKeys() {
  switch ($this->oauthConfig['provider']) {
    case 'key':
      $credentials = [];
      $keyId = $this->oauthConfig['data']['id'];
      $keyEntity = $this->keyRepository
        ->getKey($keyId);
      if ($keyEntity instanceof Key) {

        // A key was found in the repository.
        $credentials = $keyEntity
          ->getKeyValues();
      }
      break;
    default:
      $credentials = $this->oauthConfig['data'];
  }
  return $credentials;
}