Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6573765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:10:31+00:00 2026-05-25T15:10:31+00:00

Been wrestling with this for many hours now, the Docs seem to be terrible.

  • 0

Been wrestling with this for many hours now, the Docs seem to be terrible. Basically I’m trying to get read access to an OAuth2 authenticated users contacts, using either the Portable Contacts API or the full blown Contacts API. Google have recently started allowing OAuth2.

I can get access to a users contacts via the Contacts API by first getting the user to authenticate with the scope: “https://www.google.com/m8/feeds”. Then I can retrieve their first 25 contacts using jQuery (code shown is CoffeeScript)

$.ajax
  url: "https://www.google.com/m8/feeds/contacts/default/full"
  dataType: 'jsonp'
  data: { access_token: token, alt: 'json-in-script' }
  success: (data, status) ->
    console.log "The returned data", data

That works, and I get JSON data. However, almost unbelievably, the only contacts order that Google provides (as far as I can tell) is ‘lastmodified‘ (seriously wtf?). I need something more like ‘top friends’ or ‘most popular’.

Which, happens to be something that the Google Portable Contacts API can do, (Yay!). Of course, I can’t seem to get a successful request to work.

First, I get the user to authenticate with the portable contacts API by clicking this link (note the scope: “https://www-opensocial.googleusercontent.com/api/people”)

<a href="https://accounts.google.com/o/oauth2/authclient_id=457681297736.apps.googleusercontent.com&response_type=token&redirect_uri=http://localhost:3000/team&scope=https://www-opensocial.googleusercontent.com/api/people">Import Google Contacts</a>

That works fine, and I get an access token passed back.

Next I try to send an ajax request to the portable contacts API

$.ajax
  url: "https://www-opensocial.googleusercontent.com/api/people/@me/@all"
  dataType: 'jsonp'
  data: { access_token: token, alt: 'json-in-script' }
  success: (data, status) ->
    console.log "The returned data", data

But that returns a 403 Error

403 (The currently logged in user and/or the gadget requesting data, does not have access to people data.

Any ideas what I’m doing wrong?

Appendix
I found this bug report in the Google OAuth2 forum which advised that we need to set an authorization header when working with the Portable Contacts API. So I tried that like this:

$.ajax
  url: "https://www-opensocial.googleusercontent.com/api/people/@me/@all"
  dataType: 'jsonp'
  data: { access_token: token, alt: 'json-in-script' }
  beforeSend: (xhr) ->
    xhr.setRequestHeader "Authorization", "OAuth #{token}"
  data: { access_token: token }
  success: (data, status) ->
    console.log "The returned data", data

But that gets me the same 403 error:

403 (The currently logged in user and/or the gadget requesting data, does not have access to people data
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:10:31+00:00Added an answer on May 25, 2026 at 3:10 pm

    The problem is that you apparently can’t set a request header on a JSONP request. See the answer on this question for more information.

    The alternatives as far as I can see are:

    1. Use the Google Contacts API JS library. That only uses AuthSub which google themselves suggest is bad. I would rather not do this. Every other service I interact with uses OAuth2.
    2. Use the new Level 2 Ajax and XDomainRequest standards mentioned in the SO question I linked to. However they will come with their own problems. It sounds like a mess overall. It won’t work in older browsers and I’ll have to do a bunch of feature detection etc. I don’t even know if the API will support these features.
    3. Do it all on the server. This isn’t exactly ideal either. Less then perfect user experience.

    It shouldn’t be this difficult Google.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been wrestling with this for almost 2 hours now and no luck. I
I've been wrestling with this problem for a few hours now and I'm beginning
been wrestling with this for some time. I am trying to access a REST
I've been wrestling with this seemingly simple re-direct task for hours now and for
I've been wrestling around with this for awhile now. I am trying to make
I feel stupid asking this question, but I've been wrestling with it for hours
So I've been wrestling with this issue all day. I can't seem to post
Ok so I have been wrestling with this and now thought I ask for
I've been wrestling with this code for a while, trying to clean it up
I've been wrestling with this for a while now. I'm not sure MYSQL query

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.