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
- Click on "ENABLE APIS AND SERVICES" as shown:
- Search for "people api" as shown, and click on Google People API:
- Enable this API as shown:
- 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:
- 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:
- Choose OAuth client ID. A new screen will appear as shown:
- Choose Web application, and give it a name by which you can identify these credentials
- Enter the "Authorized redirent URIs" as the domain of the PBX as above with "/google_token.htm" appended to that 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"
- Press "Create". New credentials will be created in the project you selected. If its the first time a new project will be created for you and the credentials will be created there
- Now you can click on the name of the credentials you gave it above and you can see the client ID and client secret created
- 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:
- And "Save" it
- 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:
- 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 shown:
- 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.