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 6590327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:17:08+00:00 2026-05-25T17:17:08+00:00

I’ve implemented the Google API v3.0, but the documentation is always telling to put

  • 0

I’ve implemented the Google API v3.0, but the documentation is always telling to put “your authorization header here”.

What’s the value we should pass as the authorization header ???

But they never mention where that value come from.
Logically, I though it could be the $_SESSION[‘access_token’] value, but when I try this:

curl_setopt($ressource, CURLOPT_HTTPHEADER, array(
     "GData-Version: 3.0",
     "Authorization: Bearer " . http_build_query(json_decode($_SESSION['access_token']))
     ));

I’m obtaining the following error:

Unknown authorization header

Error 401

And after a lot of search, I’ve tried to prepend “OAuth ” :

curl_setopt($ressource, CURLOPT_HTTPHEADER, array(
     "GData-Version: 3.0",
     "Authorization: OAuth " . http_build_query(json_decode($_SESSION['access_token']))
     ));

it will not work either, but at least the error seems more verbose :

Token invalid – Invalid AuthSub token.

Error 401

So, why are they talking about AuthSub, AFAIK ( and I don’t feel like I know much ), I’m using OAuth 2.0, not AuthSub.

And searching again about that error leads me to a possible scope problem ( http://www.geoffmcqueen.com/2010/03/14/token-invalid-authsub-token-has-wrong-scope-oauth-google-problem/ ).

So I double check my scope.
From the config.php apiConfig array:

'services' => array(
      /* ... */,
      'documentList' => array('scope' => 'https://docs.google.com/feeds/')
    )

Note that I’ve added the documentList scope myself.

My code:

        $this->authenticate();
        $arrAuth = json_decode($_SESSION['access_token']);
        $authenticationHeader = "Bearer " . $arrAuth->access_token

        $url = "https://docs.google.com" . "/feeds/default/private/full";
        $atomContent = <<<ATOM
<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns="http://www.w3.org/2005/Atom">
  <category scheme="http://schemas.google.com/g/2005#kind"
      term="http://schemas.google.com/docs/2007#folder"/>
  <title>Example Collection</title>
</entry>
ATOM;
        $ressource = curl_init();
        curl_setopt($ressource, CURLOPT_URL, $url);
        curl_setopt($ressource, CURLOPT_HTTPHEADER, array(
             "GData-Version: 3.0",
             "Authorization: {$authenticationHeader}"
             ));
        curl_setopt($ressource, CURLOPT_TIMEOUT, 5);
        curl_setopt($ressource, CURLOPT_POST, 1);
        curl_setopt($ressource, CURLOPT_POSTFIELDS, $atomContent);
        $httpResponse = curl_exec($ressource);

In case the question is not obvious for someone:
What am I doing wrong here ?

Thanks for your input… I’m struggling with that for a while now …

  • 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-25T17:17:09+00:00Added an answer on May 25, 2026 at 5:17 pm

    I believe http://code.google.com/apis/storage/docs/authentication.html is what you are looking for 🙂

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

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to construct a data frame in an Rcpp function, but when I

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.