You are here

function hubspot_oauth_connect in HubSpot 7.2

Same name and namespace in other branches
  1. 7.3 hubspot.admin.inc \hubspot_oauth_connect()

Page callback.

Saves OAuth tokens from HubSpot and redirects user.

1 string reference to 'hubspot_oauth_connect'
hubspot_menu in ./hubspot.module
Implements hook_menu().

File

./hubspot.admin.inc, line 139
Provides admin settings page to adjust HubSpot API key, debugging settings, JavaScript embedding, and form submission settings.

Code

function hubspot_oauth_connect() {
  if (!empty($_GET['access_token']) && !empty($_GET['refresh_token']) && !empty($_GET['expires_in'])) {
    drupal_set_message(t('Successfully authenticated with Hubspot.'), 'status', FALSE);
    variable_set('hubspot_access_token', $_GET['access_token']);
    variable_set('hubspot_refresh_token', $_GET['refresh_token']);
    variable_set('hubspot_expires_in', $_GET['expires_in']);
  }
  if (!empty($_GET['error']) && $_GET['error'] == "access_denied") {
    drupal_set_message(t('You denied the request for authentication with Hubspot. Please click the button again and
      choose the AUTHORIZE option.'), 'error', FALSE);
  }
  drupal_goto();
}