You are here

function hook_google_api_client_google_response in Google API PHP Client 8.4

Same name and namespace in other branches
  1. 8.3 google_api_client.api.php \hook_google_api_client_google_response()

A google response was received.

Modules may use this hook to carry operations based on google response. This is helpful when response other than authentication are received. Google response have data in url so $_GET can be used in this function.

1 invocation of hook_google_api_client_google_response()
Callback::callbackUrl in src/Controller/Callback.php
Callback URL for Google API Auth.

File

./google_api_client.api.php, line 20
Hooks provided by the Google Api Client module.

Code

function hook_google_api_client_google_response() {
  $request = \Drupal::request();
  if ($request
    ->get('state')) {
    $state = json_decode($request
      ->get('state'));
    if (isset($state['src']) && in_array('my_module', $state['src'])) {

      // Handle response only if the request was from my_module.
      return;
    }

    // Changes to be made for custom module.
  }
}