php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59663 Error on Google contact API
Submitted: 2011-03-10 12:14 UTC Modified: 2011-05-26 09:01 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:2 (66.7%)
From: djpate at gmail dot com Assigned:
Status: Open Package: oauth (PECL)
PHP Version: 5.3.5 OS: Ubuntu 10.10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: djpate at gmail dot com
New email:
PHP Version: OS:

 

 [2011-03-10 12:14 UTC] djpate at gmail dot com
Description:
------------
Hello,

I had a contact inviter script that was working on 1.0 that doesnt work anymore with 1.1.

It seems to be a problem with the request token method.

Thanks in advance.



Reproduce code:
---------------
$this->oauth = new \OAuth($this->consumer_key,$this->shared_secret);
$request_token_info = $this->oauth->getRequestToken("https://www.google.com/accounts/OAuthGetRequestToken?scope=https://www.google.com/m8/feeds/&oauth_callback=http://dev.fitizzy.com/oauth/gmail");

Expected result:
----------------
A request token

Actual result:
--------------
'OAuthException' with message 'Invalid auth/bad request (got a 411, expected HTTP/1.1 20X or a redirect)'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-10 14:09 UTC] jawed@php.net
Can you try trunk?

- JJ
 [2011-03-13 07:43 UTC] djpate at gmail dot com
The request token works from trunk but It fails when I try to fetch info

Length Required
POST requests require a Content-length header
 [2011-03-13 14:35 UTC] jawed@php.net
Are you using the cURL or streams engine?
 [2011-03-14 03:47 UTC] iceberg_young at yahoo dot com dot cn
I also got this error. Post blocked by my proxy.
 [2011-03-14 03:52 UTC] iceberg_young at yahoo dot com dot cn
More details:

Downloaded from http://pecl.php.net/get/oauth-1.1.0.tgz

source version
$Id: oauth.c 308061 2011-02-06 17:15:34Z jawed $

<?php
$bahamut = new OAuth(BAHAMUT_ID, BAHAMUT_SECRET);
$token = $bahamut->getRequestToken(BAHAMUT_OAUTH_REQUEST_TOKEN_URL, BACK_URL);
 [2011-03-14 08:35 UTC] patrick at procurios dot nl
Hate to say "Me too", but this bug is blocking for the application that is to go live by the end of this week. :}
 [2011-03-14 08:50 UTC] djpate at gmail dot com
I'm not sure of what you mean by 

Are you using the cURL or streams engine?
 [2011-03-14 15:47 UTC] jawed@php.net
The extension has two request engines, one powered by cURL and the 
other by PHP streams.

See http://us2.php.net/manual/en/oauth.setrequestengine.php

I'm not sure why the Content-Length request header would disappear from 
POST requests off hand from 1.0.

- JJ
 [2011-03-14 18:54 UTC] datibbaw@php.net
Okay, there are two problems in this ticket:
1) the request token fetching fails (seems to be fixed in 
trunk)
2) other requests are not working

Please give more details surrounding #2 or otherwise explain 
what "It fails when I try to fetch info" means.
 [2011-03-17 07:03 UTC] jawed@php.net
djpate:

http://serverfault.com/questions/65733/why-does-modsecurity-
require-content-length-in-post-requests

I'm not sure why Google requires a Content-Length header, it 
seems like in newer versions of mod_security the restriction 
is "gone".

That being said, can you guys try to do a GET request on the 
endpoint? Also the endpoint would be helpful so we can debug 
further.

- JJ
 [2011-03-17 08:25 UTC] djpate at gmail dot com
Thanks for the headsup

The endpoint is 

https://www.google.com/m8/feeds/contacts/default/full?max-results=1000&alt=json

And I can confirm that it works with a GET request
 [2011-03-17 08:51 UTC] jawed@php.net
No problem, I'm trying to figure out how to force a Content-
Length header w/POST requests in libcurl at the moment.

- JJ
 [2011-05-25 21:01 UTC] tpurdy at gmail dot com
I just encountered this same issue trying to connect to Google 
Contacts. Is there any workaround?
 [2011-05-26 09:01 UTC] datibbaw@php.net
tpurdy: Workaround is to use streams or 
authorization header :)
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Dec 07 09:01:24 2019 UTC