Hi,
I donno the language u using...
I did in python..here is the source code by which am able to fetch the
contacts..








import gdata.gauth
import gdata.docs.client
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.api import memcache
import urllib

import gdata.contacts
import gdata.contacts.service
import atom
import gdata.contacts.data
import gdata.contacts.client
import gdata.service
import gdata.docs.client
import gdata.contacts.client
SETTINGS = {
    'APP_NAME': 'your app name',  # intentionally hidden for this forum
    'CONSUMER_KEY': 'consumer key',
    'CONSUMER_SECRET': 'secret',
    'SCOPES': ['https://www.google.com/m8/feeds/'],
    'CALLBACK_URL': '',
    'SIG_METHOD': gdata.auth.OAuthSignatureMethod.HMAC_SHA1
    }
ACCESS_TOKEN='xyz'




class MainHandler(webapp.RequestHandler):
    def get(self):
        """This handler is responsible for fetching an initial OAuth
        request token and redirecting the user to the approval page."""

        SETTINGS['CALLBACK_URL'] = 'http://%s/HandleOAuthCallback' %
self.request.host
        client =
gdata.contacts.client.ContactsClient(source='timezzzzpass')
        request_token =
client.GetOAuthToken(SETTINGS['SCOPES'],SETTINGS['CALLBACK_URL'],SETTINGS['CONSUMER_KEY'],
consumer_secret=SETTINGS['CONSUMER_SECRET'])
        domain = 'default'

url=str(request_token.generate_authorization_url(google_apps_domain=domain))

        gdata.gauth.AeSave(request_token, 'myKey')
        self.redirect(str(request_token.generate_authorization_url()))
class HandleOAuthCallback(webapp.RequestHandler):
    def get(self):
        """GET request handler.
        Called when authorisation is granted by the user.
        Generates access_token, an OAuthHmacToken object.
        From this we can retrieve both the token and token_secret for a
user.
        The object is saved using AeSave().
        """
        saved_request_token = gdata.gauth.AeLoad('myKey')
        client=gdata.contacts.client.ContactsClient(source='timezzzzpass')
        request_token =
gdata.gauth.AuthorizeRequestToken(saved_request_token, self.request.uri)
        access_token = client.GetAccessToken(request_token)
        gdata.gauth.AeSave(access_token, ACCESS_TOKEN)
        TOKEN=access_token.token
        TOKEN_SECRET=access_token.token_secret

client.auth_token=gdata.gauth.OAuthHmacToken(SETTINGS['CONSUMER_KEY'],

 SETTINGS['CONSUMER_SECRET'],
                                                     TOKEN,
                                                     TOKEN_SECRET,

 gdata.gauth.ACCESS_TOKEN)
        feed=client.GetContacts()
        contacts=feed.entry
        for e in contacts:
            for em in e.email:
                self.response.out.write("Title=%s  " % e.title.text)
                self.response.out.write("email id=%s<br> " % em.address)




        self.response.out.write("Almost Done <br>")

        self.response.out.write("Done")
def main():
  application = webapp.WSGIApplication([('/', MainHandler),
('/HandleOAuthCallback', HandleOAuthCallback)],  debug=True)
  util.run_wsgi_app(application)

if __name__ == '__main__':
  main()

this will print Name and email address of the user...


On 13 June 2011 23:24, Alain Vongsouvanh <[email protected]> wrote:

> Hello Remya,
>
> Unfortunately, accessing the Google Contacts Data API requires that a user
> grants your application access to their data which means that the users need
> to be authenticated into our services first.
> However, providing the username and password is not always necessary as you
> can use OAuth (preferably OAuth 2) to ask the users to grant access without
> providing their credentials:
>   - http://code.google.com/apis/accounts/docs/GettingStarted.html
>   - http://code.google.com/apis/gdata/docs/auth/oauth.html
>
> Best,
> Alain
>
> On Mon, Jun 13, 2011 at 4:00 AM, Remya <[email protected]> wrote:
>
>> Hi ,
>>  I have a dumb question.Would the Google Contacts Data API provide me
>> with the gmail contacts of a person in specified format with out
>> providing gmail password ??
>>
>> To explain it in detail , I have an application (with around 100 of
>> users) where the users login with the username and password, and
>> provide gmail id as contact email.Can i get the gmail contacts of all
>> the users who are registered in my application with out authentication
>> by the users of the app ? I have seen facebook giving suggestions
>> w.r.t my gmail contact information.
>> Does this api help me in getting the same.
>>
>> Please reply.
>>
>> Thanks
>> Remya R.
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
>> To post to this group, send email to
>> [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://code.google.com/apis/contacts/community/forum.html
>>
>
>
>
> --
> Alain Vongsouvanh
>
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
> To post to this group, send email to
> [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://code.google.com/apis/contacts/community/forum.html
>

-- 
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/contacts/community/forum.html

Reply via email to