You are here

public static function Amazon::getAccessSecret in Amazon Product Advertisement API 8.2

Returns the secret key needed for API calls.

Return value

string|bool String on success, FALSE otherwise.

2 calls to Amazon::getAccessSecret()
Amazon::__construct in src/Amazon.php
Provides an Amazon object for calling the Amazon API.
SettingsForm::buildForm in src/Form/SettingsForm.php
Form constructor.

File

src/Amazon.php, line 79
Contains Drupal\amazon\Amazon

Class

Amazon
Provides methods that interfaces with the Amazon Product Advertising API.

Namespace

Drupal\amazon

Code

public static function getAccessSecret() {

  // Use credentials from environment variables, if available.
  $secret = getenv(self::AMAZON_ACCESS_SECRET);
  if ($secret) {
    return $secret;
  }

  // If not, use Drupal config variables. (Automatically handles overrides
  // in settings.php.)
  $secret = \Drupal::config('amazon.settings')
    ->get('access_secret');
  if ($secret) {
    return $secret;
  }
  return FALSE;
}