Hello,

You should be able to get access to the user's Contacts but this API doesn't
provide the user's username. What you are looking for might be available in
the Google+ API:
  https://developers.google.com/+/api/latest/people/get

To get access to user's contacts, you only need to send an HTTP request to
the requested API endpoint and sign the request as described here:
  http://code.google.com/apis/accounts/docs/OAuth_ref.html#SigningOAuth

Best,
Alain

On Mon, Oct 24, 2011 at 7:03 AM, shenhongzhou <[email protected]>wrote:

> Hi all,
>
> I developed a Chrome extension, in which I used OAuth. I make user login
> with google account:
> --------------code--------------------
> var oauth = ChromeExOAuth.initBackgroundPage({
>     'request_url' : 'https://www.google.com/accounts/OAuthGetRequestToken
> ',
>     'authorize_url' : 'https://www.google.com/accounts/OAuthAuthorizeToken
> ',
>     'access_url' : 'https://www.google.com/accounts/OAuthGetAccessToken',
>     'consumer_key' : 'anonymous',
>     'consumer_secret' : 'anonymous',
>     'scope' : 'http://www.google.com/m8/feeds/',
>     'app_name' : 'myExtension'
>   });
> --------------code--------------------
> And then, I let the user visit my web application (myWebAppUrl):
> --------------code--------------------
>  oauth.sendSignedRequest(myWebAppUrl, function(responseText, req) {
>       if (req.status == 200) {
>       //access sucessful ....
>       } else {
>         //access failed ......
>       }
>     }, {
>         'method': 'GET',
>         'headers': {
>           'X-Same-Domain': 'true',
>           'Content-Type': 'application/json;charset=UTF-8'
>         }
>       });
> --------------code--------------------
> In the servlet of my web application, I can get user's request with 6 OAuth
> parameters:
> --------------code--------------------
> oauth_consumer_key=anonymous
> oauth_nonce=******
> oauth_signature=*******
> oauth_signature_method=HMAC-SHA1
> oauth_timestamp=1319428871
> oauth_token=**********
> --------------code--------------------
> My question is:
> In my servlet, can I use this 6 parameters to access Google Contacts API
> and get user's username?
> If can, how can I do it?
>
> Thank you very much.
>
> --
> 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 | Developer Programs Engineer

-- 
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