Announcement

Collapse
No announcement yet.

Configuring Google Credentials

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Configuring Google Credentials

    Since Google use OAuth2 authentication protocol (which is not designed for console applications) this can be most difficult part depending on your OS and your setup.

    For initial credentials setup you have to use web browser on same computer where HS server is installed and logged in in your browser with your Google email.


    For Linux please see post #6 first and this thread !

    Go to Google Calendar device configuration:
    Click image for larger version  Name:	config.jpg Views:	0 Size:	66.4 KB ID:	1484172
    ‚Äč Google changed the procedure, again. So I'll try to document the steps.

    It's a bit crazy, just follow the steps.
    1. Go to https://console.cloud.google.com/cloud-resource-manager

    2. Create New Project


    Click image for larger version  Name:	creds1.png Views:	0 Size:	45.0 KB ID:	1484173
    3.Name the project (any name)

    Click image for larger version  Name:	creds2.jpg Views:	0 Size:	49.5 KB ID:	1484174
    4. Select the created project

    Note: eaiser option for the following instructions is using project urls, I'll also list the urls - you need to append your project ID to the urls (i.e. project=gcal-3-320002)

    Click image for larger version  Name:	creds1a.jpg Views:	0 Size:	7.1 KB ID:	1484175
    5. Select "APIs and services" and Dashboard. Select "ENABLE APIS AND SERVICES"

    URL: https://console.cloud.google.com/api...=gcal-3-320002
    Click image for larger version  Name:	creds4a.png Views:	0 Size:	49.8 KB ID:	1484176 Click image for larger version  Name:	creds4.png Views:	0 Size:	27.8 KB ID:	1484177
    6. Select "Google Calendar API" and Click ENABLE

    URL: https://console.cloud.google.com/api...=gcal-3-320002
    Click image for larger version  Name:	creds5.jpg Views:	0 Size:	28.1 KB ID:	1484178 Click image for larger version  Name:	creds6.jpg Views:	0 Size:	30.0 KB ID:	1484179
    7. Select "Create Credentials".

    Select Google Calendar API from the list, select "User Data", then "Next":


    URL: https://console.cloud.google.com/api...=gcal-3-320002
    Click image for larger version  Name:	creds7.jpg Views:	0 Size:	55.3 KB ID:	1484183 Click image for larger version  Name:	creds8.jpg Views:	0 Size:	80.6 KB ID:	1484184
    8. CONFIGURE CONSENT SCREEN -

    Enter App Name, Email (twice), Click "SAVE AND CONTINUE"


    Click image for larger version  Name:	creds9a.jpg Views:	0 Size:	71.1 KB ID:	1484185
    9. On SCOPES screen Click "ADD OR REMOVE SCOPES"

    Select "calendar.readonly" and "calendar.events", click "UPDATE",
    Click "SAVE AND CONTINUE"

    Click image for larger version  Name:	creds9.png Views:	0 Size:	71.0 KB ID:	1484186
    10. "OAuth Client ID"

    Application type: Desktop App, Click "Create" and "Done"

    Click image for larger version  Name:	creds10.jpg Views:	0 Size:	85.8 KB ID:	1484188
    11. "OAuth consent screen"

    URL: https://console.cloud.google.com/api...=gcal-3-320002

    Test users => ADD USERS

    Add your gmail address again

    Click image for larger version  Name:	creds13.png Views:	0 Size:	60.5 KB ID:	1484199
    12. Select 'pencil' to see the client ID and Secret

    URL: https://console.cloud.google.com/api...=gcal-3-320002

    Click image for larger version  Name:	creds11.jpg Views:	0 Size:	77.0 KB ID:	1484198
    13. Copy"Client ID" and "Client Secret" to your Google Calendar Credentials configuration and click "Save"

    Google should pop-up OAuth authorisation window, follow the prompts. When finished - the plugin should get the list of you calendarts and create HS devices - 5 event devices per calendar.

    Click image for larger version  Name:	config.jpg Views:	0 Size:	66.4 KB ID:	1484200

    #2
    Using authenticator.exe for headless HS install

    If the HS is installed on headless (no GUI) Linux computer - the last reserve is to use authenticator.exe on another computer which does have GUI (better Windows) to obtain authorization token from Google. The app is included in the plugin install in "HS root"/bin/AKGoogleCalendar - copy the whole folder to Windows computer.

    Note 1: Before using authenticator.exe you still have to obtain (and save/Submit on the config page) ClientID and ClientSecret from Google - follow instructions post #2 Configuring Google Credentials.

    Note 2: On Linux even if you execute a command from the directory where it's located - you still need to prepend path, i.e:
    Code:
    ./authenticator.exe
    Note 3: And make sure on Linux it has the executable bit set, i.e:
    Code:
    sudo chmod a+x authenticator.exe

    Now execute:
    Code:
    authenticator.exe ClientID ClientSecret
    It should request "User login & consent" and receive "Authorisation code" and on success print list of your calendars:

    Code:
    *********************************************
    Credential file saved to: D:\My\Temp\Release\token.json
    
    D:\My\Temp\Release\token.json\Google.Apis.Auth.OAuth2.Respon ses.TokenResponse-user
    
    *********************************************
    pp08kp35e77ap05mmm94a00gmk@group.calendar.google.com
    S-Heat #f691b2 i04d1nir7395dmril3dvpstijg@group.calendar.google.com
    S-Gates #16a765 jgcuopiksi78f231qq5t23b2pg@group.calendar.google.com
    omeseer #fbe983 95dfa41185hao6gmvpss2nelro@group.calendar.google.com HS-TV #ffad46
    All you need to do now - in Google Calendar Credentials configuration click "Upload Credentials" and point to the file received above. This should copy the file to the plugin bin folder on HS machine.

    Alternatively you can copy created token.json folder manually to: "HS root"/Bin/AKGoogleCalendar/token.json"

    Then restart plugin.

    Comment

    Working...
    X