longliangyou / Meteor-Google-Contacts

Node.js wrapper for the Google Contacts API (uses OAuth 2.0 token authentication), repackaged for Meteor
https://atmospherejs.com/long/google-contacts
10 stars 6 forks source link

Meteor wrapper for the Google Contacts API, based on Lajos Koszti's Node library, and unfortunately quite a few commits behind it. PR's welcome.

Install

meteor add long:google-contacts

Usage

opts =
  email: userEmail
  consumerKey: googleId
  consumerSecret: googleSecret
  token: googleAccessToken
  refreshToken: googleRefreshToken

gcontacts = new GoogleContacts opts

gcontacts.refreshAccessToken opts.refreshToken, (err, accessToken) ->
  if err
    console.log 'gcontact.refreshToken, ', err
    return false
  else
    console.log 'gcontact.access token success!'
    gcontacts.token = accessToken
    gcontacts.getContacts (err, contacts) ->
      // Do what you want to do with contacts
      // console.log(contacts);

    gcontacts.getPhoto contact.photoUrl, (err, binaryData) ->
      // Save binaryData to you DB or file.