You are here

static function handler::miniorange_oauth_client_validate_code in Drupal OAuth & OpenID Connect Login - OAuth2 Client SSO Login 8

File

src/handler.php, line 15

Class

handler

Namespace

Drupal\miniorange_oauth_client

Code

static function miniorange_oauth_client_validate_code($code, $request_code, $request_time) {
  $current_time = time();
  if ($current_time - $request_time >= 400) {
    echo "Your authentication code has expired. Please try again.";
    exit;
  }
  if ($code == $request_code) {

    //variable_set('miniorange_oauth_client_code','');
    \Drupal::configFactory()
      ->getEditable('miniorange_oauth_client.settings')
      ->set('miniorange_oauth_client_code', '')
      ->save();
  }
  else {
    print_r("Incorrect Code");
    exit;
  }
}