function formassembly_oauth_authorization_callback in FormAssembly 7
Callback that executes when the user returns after authorizing the app.
1 string reference to 'formassembly_oauth_authorization_callback'
- formassembly_menu in ./
formassembly.module - Implements hook_menu().
File
- ./
formassembly.module, line 271 - Contains hooks implementations and callbacks to non-admin pages.
Code
function formassembly_oauth_authorization_callback() {
if (!empty($_GET['code'])) {
$client_id = variable_get('formassembly_oauth_cid', '');
$client_secret = variable_get('formassembly_oauth_secret', '');
$request = new FormAssemblyRequest($client_id, $client_secret);
if ($request
->getToken($_GET['code'])) {
drupal_set_message(t('Authorization Successful'));
watchdog('formassembly', 'OAuth authorization successful.', array(), WATCHDOG_NOTICE);
}
else {
drupal_set_message(t('Authorization Failed'), 'error');
watchdog('formassembly', 'OAuth authorization failed.', array(), WATCHDOG_ERROR);
}
}
// Redirect back to the settings form.
drupal_goto('admin/config/services/formassembly');
}