You are here

function fonts_com_get_existing_key_for_account in @font-your-face 7.2

Gets auth key for a given account.

1 call to fonts_com_get_existing_key_for_account()
fonts_com_get_key_for_account in modules/fonts_com/api.inc
Gets auth key for a given account.

File

modules/fonts_com/api.inc, line 168
API functions.

Code

function fonts_com_get_existing_key_for_account($email, $password) {
  $path = '/rest/json/GetToken/?wfsemail=' . $email;
  $response = drupal_http_request(FONTS_COM_API_BASE_URL . $path, array(
    'headers' => array(
      'AppKey' => FONTS_COM_API_APP_KEY,
      'Password' => $password,
    ),
  ));
  if ($response->code == 200) {
    $data = json_decode($response->data);
    if (isset($data->Accounts) && isset($data->Accounts->Account) && isset($data->Accounts->Account->AuthorizationKey)) {
      return $data->Accounts->Account->AuthorizationKey;
    }

    // if
  }

  // if
  return FALSE;
}