You are here

static function handler::miniorange_oauth_client_validate_code in OAuth2 Login 8

File

src/handler.php, line 21

Class

handler

Namespace

Drupal\oauth2_login

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) {
    \Drupal::configFactory()
      ->getEditable('oauth2_login.settings')
      ->set('miniorange_oauth_client_code', '')
      ->save();
  }
  else {
    print_r("Incorrect Code");
    exit;
  }
}