Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Automatically Approve App on change of OAuth Callback URL

I have zero experience with PHP. I am trying to extend developer portal by calling API which automatically approves App instead of putting it in Pending state when a developer changes the OAuth callback URL.

I am unable to invoke /var/www/html/profiles/apigee/modules/custom/devconnect/devconnect_developer_apps/devconnect_developer_apps.api.php - hook_devconnect_developer_app_presave(). I have added below code

function hook_devconnect_developer_app_presave(array &$form_state) {
  dd('Presave app!');
  $form_state['values']['attribute_drupal_uid'] = $form_state['values']['uid'];
  $new_callback_url = $form_state['values']['new_callback_url'];
  watchdog('devconnect_developer_apps', 'new_callback_url, %new_callback_url',array('%node_title' => $node->title), WATCHDOG_INFO, NULL);
  return TRUE;
}

I don't see any messages written to admin/reports/dblog. Any idea why hook_devconnect_developer_app_presave() is not getting called when I edit my app from devportal user/<user-id>/apps/<app-id>/edit-app

Solved Solved
0 6 373
1 ACCEPTED SOLUTION

Dear @Vineet Bhatia ,

You need to replace hook word with your custom MODULENAME . Clear the caches & check.

function YOURMODULENAME_devconnect_developer_app_presave(&$form_state) {
  dd('Presave app!');
  $form_state['values']['attribute_drupal_uid'] = $form_state['values']['uid'];
  $new_callback_url = $form_state['values']['new_callback_url'];
  watchdog('devconnect_developer_apps', 'new_callback_url, %new_callback_url',array('%node_title' => $node->title), WATCHDOG_INFO, NULL);
  return TRUE;
}

Find more about hooks here

View solution in original post

6 REPLIES 6