Just tried fetching the user info by using the same code and it works. Is there any special setting for google contacts?
On 1 February 2012 16:45, Tony <[email protected]> wrote: > Hi, > I have been trying to use OAuth2 and access a user's google contacts. > > I followed example on google(which is for installed app but I changed it > to use web app). it works fine until I try sending the access token to > google contacts api, it returns me "400 Bad Request" error without meaning > info. > > I have tried auth play ground and confirmed that the access token is > correct. > > Can you please take a look at the following code, what change should I > make ? > > // Make an authenticated request > GenericUrl shortenEndpoint = new GenericUrl(" > https://www.google.com/m8/feeds/contacts/full"); > HttpRequest request = rf.buildGetRequest(shortenEndpoint); > GoogleHeaders headers = new GoogleHeaders(); > headers.setContentType("application/x-www-form-urlencoded"); > headers.setAuthorization("OAuth " + accessToken); > request.setHeaders(headers); > HttpResponse shortUrl = request.execute(); <---"400 error out" > > -- > 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 > -- Best regards, Tony Zhang 1place Limited Level 3, 11 Clayton Street, Newmarket |Auckland 1740, New Zealand Phone: +64 9 5200612 | Mob: +64 21 813900 Email: [email protected] | www.1placeonline.com -- 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
