title: Locally testing Google API Client watch events
body: <p>I'm using the <a href="https://github.com/google/google-api-ruby-client" rel="nofollow">google api ruby client</a> to add a webhook to a calendar but I'm running into a <code>Google::Apis::ClientError: pushWebhookBadDomain</code>.</p>
  
  <p>I've set up an ngrok instance and verified it on webmaster tools so that I could add it as an allowed domain to the project that's handling all the calendar auth, etc. I can't find any reference to that specific error so I'm wondering if there's something funky with using ngrok for that and if there are any better ways to go about testing the webhooks locally.</p>
  
  <p>Here's the call (condensed for clarity) in case I'm doing anything stupid:</p>
  
  <pre><code>require 'google/apis/calendar_v3'
  client = Google::Apis::CalendarV3::CalendarService.new
  authorization = Signet::OAuth2::Client.new(
    :authorization_uri =&gt;
      'https://accounts.google.com/o/oauth2/auth',
    :token_credential_uri =&gt;
      'https://accounts.google.com/o/oauth2/token'
  )
  authorization.client_id = ENV['GOOGLE_CLIENT_ID']
  authorization.client_secret = ENV['GOOGLE_CLIENT_SECRET']
  authorization.grant_type = 'refresh_token'
  authorization.refresh_token = refresh_token
  authorization.fetch_access_token!
  client.authorization = authorization
  
  channel = Google::Apis::CalendarV3::Channel.new(address: success_callback_url, id: channel_id, type: "web_hook")
  binding.pry
  webhook = client.watch_event('primary', channel, single_events: true, time_min: Time.now.iso8601)
  </code></pre>