Hello,

Would it be possible for you to log the request you are sending? Please make
sure to hide your client secret.

Best,
Alain

On Tue, Sep 13, 2011 at 9:30 PM, debashish <[email protected]> wrote:

> Thanks Alain for the reply.However ,noe I got another new error:
>
> *Update* I somehow did reset my client-secret , and for a time , I got the
> proper XML response . But , suddenly , out of the blues ,it has started
> giving me a new error .
>
> Just after the curl call to get the *access_token* , it shows me
> {"error":"invalid_grant"}. Why this is so ?
>
> On Tue, Sep 13, 2011 at 2:16 PM, Alain Vongsouvanh <[email protected]>wrote:
>
>> Hello,
>>
>> This looks like an OAuth 2 issue. You mentioned that this is working when
>> running your code again, is that correct?
>> If you can easily reproduce the issue, and have a way to show us how to do
>> it, please feel free to file an issue against the Google Apps API issue
>> tracker<http://code.google.com/a/google.com/p/apps-api-issues/issues/list>(mentioning
>>  that this is an issue with OAuth 2 and not a particular API).
>>
>> Best,
>> Alain
>>
>> On Tue, Sep 13, 2011 at 6:44 AM, debashish <[email protected]> wrote:
>>
>>> I am using OAUTH2 authentication to import GMAIL contacts . In my code
>>> I am storing the config  parameters in an array :
>>>
>>>    $clientid=<my Client id>;
>>>    $clientsecret=<my client secret>;
>>>    $redirecturi=<my redirect URL>;
>>>    $max_results = 25;
>>>
>>> Below is how I create the POST array :
>>>
>>>    $fields=array(
>>>        'code'=>  urlencode($auth_code),
>>>        'client_id'=>  urlencode($clientid),
>>>        'client_secret'=>  urlencode($clientsecret),
>>>        'redirect_uri'=>  urlencode($redirecturi),
>>>        'grant_type'=>  urlencode('authorization_code')
>>>    );
>>>
>>>    $post = '';
>>>    foreach($fields as $key=>$value) { $post .= $key.'='.$value.'&'; }
>>>    $post = rtrim($post,'&');
>>>
>>> Now I'm making a **CURL** call to get the access token :
>>>
>>>    $curl = curl_init();
>>>    curl_setopt($curl,CURLOPT_URL,'https://accounts.google.com/o/
>>> oauth2/token' <https://accounts.google.com/o/oauth2/token'>);
>>>    curl_setopt($curl,CURLOPT_POST,5);
>>>    curl_setopt($curl,CURLOPT_POSTFIELDS,$post);
>>>    curl_setopt($curl, CURLOPT_RETURNTRANSFER,TRUE);
>>>    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
>>>    $result = curl_exec($curl);
>>>    curl_close($curl);
>>>
>>>
>>>    $response =  json_decode($result);
>>>    $accesstoken = $response->access_token;
>>>    log_message('debug','POST'.$post);
>>>    log_message('debug','contents'.$result);
>>>
>>> Here is where I am having trouble.
>>> For the **first callback** , this request access token process return
>>> a **Error 500** response which is displayed in my logs as follows :
>>>
>>>    <HTML>
>>>    <HEAD>
>>>    <TITLE>Error processing OAuth 2 request</TITLE>
>>>    </HEAD>
>>>    <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
>>>    <H1>Error processing OAuth 2 request</H1>
>>>    <H2>Error 500</H2>
>>>    </BODY>
>>>    </HTML>
>>>
>>> But for **all subsequent callbacks**, I am getting the proper access
>>> token .
>>>
>>> What's going wrong for the first time ?
>>>
>>>
>>>
>>> --
>>> 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
>>
>
>
>
> --
> Regards----
> Debashish Ghosh
>
>  --
> 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