Google Contacts
  • 11 May 2021
  • 3 Minuten zu lesen
  • Mitwirkende
  • Dunkel
    Licht
  • pdf

Google Contacts

  • Dunkel
    Licht
  • pdf

There is no German content available for this article, You are viewing the fallback version (English).

With google contacts, you can sync your google contacts through OAuth2 with the Vodia PBX, using the Google People API. With OAuth2 your password information need not be stored on the system. Instead, a separate window pops up to verify your credentials and provide an auth code, which you use to sync the contacts automatically every 10 minutes. You can stop it by pressing the button to log out form the account and stop syncing. It will also stop if the PBX is stopped. On restart of the PBX you will have to verify your credentials again for the periodic syncing of the contacts.

Obtain Client ID and Client Secret

Before the users of a domain can use the google contacts, you have to obtain the client id and client secret for that domain and enter it in the PBX domain settings.

  • Sign in to the google account which you want to use for getting the id and secret .

  • Then go to: https://console.developers.google.com

  • You have to create a new project if you don't see the following option already.

  • After the Project has been created (or if it already exists) click on "ENABLE APIS AND SERVICES" as shown:
    httpsdocvodiacomsitesdefaultfilesinline-imagesgooglecontacts11.png

  • Search for "People Api" as shown, and click on Google People API:
    httpsdocvodiacomsitesdefaultfilesinline-images1101.png

  • Enable this API as shown:
    httpsdocvodiacomsitesdefaultfilesinline-imagesgooglecontacts301.png

  • Now that the Google People API has been enabled, you can create your credentials and obtain the client id and secret

  • For that, go back to: https://console.developers.google.com

  • Under "Credentials", go to the OAuth consent screen as shown:
    httpsdocvodiacomsitesdefaultfilesinline-imagesgooglecontacts41.png

  • This is the consent information that the user will be presented for giving access to his contacts

  • The details here are only for testing, you should enter your own company and domain information here, then save.

  • Finally, go to the Credentials tab under "Credentials" and click on "Create credentials" as shown:
    httpsdocvodiacomsitesdefaultfilesinline-images31.png

  • Choose "OAuth client ID", a new screen will appear as below:
    1.png

  • Choose Web application, and give it a name by which you can identify these credentials

  • Enter the "Authorized JavaScript origins" as the domain of the PBX (the domain with which you can reach the PBX domain in the browser). We've entered "localhost" of our test bed, here.

  • Enter the "Authorized redirect URIs" as the domain of the PBX as above with "/google_token.htm" appended to the above URI.

  • This is very important that the URI is reachable to your PBX domain as that is where it will be redirected after user consent

  • For example: If the domain is https://example.com, then you will have to enter here "https://example.com/google_token.htm"


Now navigate to "OAuth Consent Screen"

  • Select the user type depending on whether you need local organization's contacts or external. We've selected "Internal" and then hit Create:
    34.png

Address the 3 step App registration process

Step 1: OAuth Consent Screen
33.png

Step 2: Scopes
It allows you to set the scope of your API which you can keep pretty standard.

Step 3: Summary
Conclusion of your settings can be seen and edited on this step. And then hit Create.

  • After you hit "Create", new credentials (Client ID and Key will pop up on your screen) will be created in the project you selected. If it's the first time a new project will be created for you and the credentials will be created there.

  • Copy the client ID and client secret in the PBX domain settings in the "Google contacts client ID" and "Google contacts client secret" fields respectively, as shown:
    1.png

  • And hit "Save".

  • Now the users (extensions) in this domain can get access to their Google Contacts by providing consent using their own google account and password through OAuth authentications, explained below.

How to Sync Contacts

Before google contacts can be synced, the user has to give consent by using his own google account and password.

  • Go to your user portal settings as shown below (User Portal > Settings > "Ellipsis" button > Google):
    httpsdocvodiacomsitesdefaultfilesinline-imagesgooglecontacts81.png

  • Press "Get Auth Code".

  • A new window will pop up asking you to sign in with your google account if you are not signed in already in another tab.

  • Sign in with your google account and password.

  • A new screen will appear asking you for consent as below:
    httpsdocvodiacomsitesdefaultfilesinline-imagesgooglecontacts91.png

  • Press "Allow" to give your domain consent to sync your contacts.

  • The information here for testing purposes, but here you will see what was set in the consent screen above during credentials creation.

  • The Google Contacts will be synced which you can see in your user portal contacts.

  • It may take some time to sync, so give it some time. This process needs to be done only once. After that, the system will re-sync the contacts every 10 minutes automatically.

  • These contacts will also appear on your phone through LDAP.

  • To logout from the account, press the button.


War dieser Artikel hilfreich