Google API Test Connection not working

I have read all the threads and watched videos on this to ensure that I have setup everything correctly. I have no idea where the issue may reside...

[July 16, 2014 2:49 pm] Error calling POST https://www.googleapis.com/calendar/v3/calendars/mghc1rkoftmki1fv96g43ipf3o@group.calendar.google.com/events: (401) Invalid Credentials
[July 16, 2014 2:57 pm] Error refreshing the OAuth2 token, message: '{
"error" : "invalid_grant"

The message to me indicates the following:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}

  • Richard Gibson

    Hello Vaughan

    No luck on that one.... I updated the primary calendar and shared it with the google service account email ... no luck ... got the following message:

    [July 16, 2014 7:02 pm] Error refreshing the OAuth2 token, message: '{
    "error" : "invalid_grant"
    }'
    [July 16, 2014 7:02 pm] Error calling POST https://www.googleapis.com/calendar/v3/calendars/mghc1rkoftmki1fv96g43ipf3o@group.calendar.google.com/events: (401) Invalid Credentials

  • pxwm

    Hi @Vaughan - I hope you don't mind me making a few suggestions

    Hi @Richard Gibson

    I've checked your screenshots and I think I've identified some setting problems.

    Could you please try these in order:-

    In A+ Google calendar change the 'Appointments will be sent to Google calendar for' field FROM: ALL TO: no preference case

    Then Save

    Then try clicking the test connection - I don't expect this to work but worth trying first

    If still fails then please retain the changed settings above and try the following:-

    From the screenshots I think your Private Key should be the value in your screenshot field called 'Public key fingerprints' that starts '52b1b62c5071c....

    Please change this and I also add '-privatekey' at the end so for your Private key I think it should be: 52b1b62c5071c1e919087d4ab4b11f62a56cd289-privatekey
    Then Save
    You will also need to upload this key as per the A+ instructions in the A+ 'Google calendar' tab by clicking the 'i' link

    You should have a file name called: 52b1b62c5071c1e919087d4ab4b11f62a56cd289-privatekey.b12
    Then try clicking the test connection

    If still fails then please retain the changed settings above and try the following:-

    just wanted to check one of the settings:-

    In A+ Google calendar' tab fields name 'Calendar to be used' you appear to have entered 'mghc1rkoftmki1fv96g43ipf30@group.calendar.google.com'

    However I notice from another screenshot you have: 'mrrickgibson@gmail.com'

    Is it possible you could try replacing
    FROM: mghc1rkoftmki1fv96g43ipf30@group.calendar.google.com
    TO: mrrickgibson@gmail.com

    Then Save
    Then try clicking the test connection

    I hope this helps

    Regards
    SteveB

  • Richard Gibson

    Hello Steve!

    From the screenshots I think your Private Key should be the value in your screenshot field called 'Public key fingerprints' that starts '52b1b62c5071c....

    Please change this and I also add '-privatekey' at the end so for your Private key I think it should be: 52b1b62c5071c1e919087d4ab4b11f62a56cd289-privatekey
    Then Save
    You will also need to upload this key as per the A+ instructions in the A+ 'Google calendar' tab by clicking the 'i' link

    When you create a .p12 key the file name does not look the same as what you suggested the private key look like. I simply renamed the key in the key folder to match 52b1b62c5071c1e919087d4ab4b11f62a56cd289-privatekey. THIS WORKED AND I WAS ABLE TO TEST AND IT CREATED THE CALENDAR ENTRY!

    The solution was to take the entire public key, add the -privatekey extension and rename the .p12 file that google creates with what is similar to above...that simple! THANK YOU

    Now I am going to test to see if A+ blocks out the times when creating an appointment. This will be key for me to complete this awesome tool!

    More to come......Rick

  • pxwm

    Hi @Richard Gibson

    Many thanks for the update and I'm pleased it is working.

    Just to confirm if you book an appointment in the A+ front end it should populate your google calendar but it can take up to 15mins to sync up.

    However if you wish to make Bookings through your google calendar then your current settings will allocate the booking in A+ to 'no preference' as you only have a single calendar set up in your A+ 'Google calendar tab and it will place the appointment in the 'Reserved by GCAL' appointment admin panel.

    You can make settings changes within the A+ 'General' tab so Admin would receive an email notification. You would then have to login to your A+ Admin panel and then select 'Appointments' option and then select the 'Reserved by GCAL' and then assign the booking to a specific Service Provider.

    If you wanted to make Bookings from your google calendar to a specific Service Provider then you would have to set up a google calendar for each Service Provider, then create an API key for each Service Provider and then change the settings in the A+ 'Google calendar' tab for each Service Provider and then if you went to each Service Provider Wordpress user profile you can perform the same set up as you did in the A+ 'Google calendar' tab.

    Regards
    SteveB

  • Richard Gibson

    Hello Steve

    Yes... All appointments will be made through the A+ front end web page and I did not see how I could link the two calendars together...so I am reserving specific times in the A+ google calendar since there is only one service provider.

    Since it is not advisable to use the primary calendar i am blocking off a specific times when they can be made since I cannot link to the primary calendar which will be reserved for appointments.

    Is there any way for A+ calendar to be sensitive to the primary calendar?
    Thanks
    Rick

  • pxwm

    Hi @Richard Gibson

    I just want to check I have understood correctly:-

    You have a Google Primary calendar
    You have set up a secondary Google calendar for A+

    Am I correct?

    When you state 'It is not advisable to use the 'Primary calendar'

    I can't recall there is a problem using a Google Primary calendar.
    I know it is not advisable to use a Business Google calendar.

    I have used a Google Primary calendar for testing and haven't experienced problems.
    Is it maybe that you don't want to 'mix' your other appointments in your Primary Google calendar and the A+ Bookings?

    If not could you maybe expand on what the Primary Google calendar is used for.

    Regards
    SteveB

    • Richard Gibson

      You have a Google Primary calendar
      You have set up a secondary Google calendar for A+

      Yes, this is the way I set this up based on creating the new project..

      The primary calendar has a mix of personal meetings and while I can see the A+ appointments on the primary calendar since I have shared it, the issue is when I show availability in the A+ web calendar, I had to block off times in the primary calendar to show on the web calendar as "not available'.

      When testing deeper, I have 2 services provided by the same provider. When looking at the first service, it shows times blocked off. When looking at the second service 'available times" it show them as open?Screenshots attached..

  • pxwm

    Hi @Richard Gibson

    If I've understood correctly I suspect this is due to settings in A+.

    Could you please confirm the following:-

    In the A+ 'Services' tab could you confirm what you have the value in the 'Capacity' field set to for each 'Service'?

    If it is NOT set to '0' can you please change to '0' for both 'Services' and Save.

    I'm hopeful this will then block out a time slot once one of the Services has been booked.

    Please let me know if this is the case and if it works when you have changed.

    Regards
    SteveB

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.