PHP Classes

Oauth access token into database

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  Improving the Protect...  >  All threads  >  Oauth access token into database  >  (Un) Subscribe thread alerts  
Subject:Oauth access token into database
Summary:saving the access token and reusing it without asking for login
Messages:46
Author:Prabhulal Ramesh
Date:2014-11-20 12:59:04
 
  1 - 10   11 - 20   21 - 30   31 - 40   41 - 46  

  31. Re: Oauth access token into database   Reply   Report abuse  
Picture of Prabhulal Ramesh Prabhulal Ramesh - 2014-11-22 07:18:41 - In reply to message 30 from Manuel Lemos
Lemos , your Library is amazing. And you did support whenever i needed help , thank you very much .


I need to know how the tumblr share link works.

can u send me the share link alone and passing parameters ??

or is it same as linkedin share parameters. ???

  32. Re: Oauth access token into database   Reply   Report abuse  
Picture of Prabhulal Ramesh Prabhulal Ramesh - 2014-11-22 08:54:36 - In reply to message 30 from Manuel Lemos

CAn u Please help me with twitter !!!!!!!!!

I am getting some 401error ...

ERROR it was not possible to access the OAuth request token: it was returned an unexpected response status 401 Response: oauth_signature does not match expected value
Close


  33. Re: Oauth access token into database   Reply   Report abuse  
Picture of Prabhulal Ramesh Prabhulal Ramesh - 2014-11-22 14:10:55 - In reply to message 25 from Manuel Lemos
Hello Lemos , I am got able to get the tumblr api post to work.

Error: the access token is not set to a valid value object(mysqli_oauth_client_class)

I am using the api call, for post like this... but how do i get the parameter
base-hostname here ??

api.tumblr.com/v2/blog/{base-hostna ...

  34. Re: Oauth access token into database   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-11-22 19:45:11 - In reply to message 31 from Prabhulal Ramesh
I am not sure what you mean, but the class works the same with all OAuth servers.

I think the only thing that may be different is the API calls you need to perform to integrate them with your application.

  35. Re: Oauth access token into database   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-11-22 19:47:02 - In reply to message 32 from Prabhulal Ramesh
This usually means you are not passing the correct client_id or client_secret to the class.

  36. Re: Oauth access token into database   Reply   Report abuse  
Picture of Prabhulal Ramesh Prabhulal Ramesh - 2014-11-23 02:40:59 - In reply to message 35 from Manuel Lemos
I am getting the user info correctly , but can u tell me which api should be used to post share text and link ??


this is my code


if(($success = $client->Initialize()))
{


/*
* The call to the Process function should not be done here anymore
* because the access token will be retrieved from the database
*/

$success = $client->CallAPI(
'http://api.tumblr.com/v2/user/info',
'GET',array(), array('FailOnAccessError'=>true) , $user);



print_r($user);

echo '<br>a<br>';
$tumblrhostname = $user->response->user->name;

$parameters = new stdClass;
$parameters->comment = "Test ";
$parameters->content = new stdClass;
$parameters->content->title ='Titleee ';
$parameters->content->{'submitted-url'} = 'content' ;
$parameters->visibility = new stdClass;
$parameters->visibility->code = 'anyone';



$success = $client->CallAPI(
'http://api.tumblr.com/v2/blog/'.$tumblrhostname.'.tumblr.com/posts',
'POST', $parameters, array('FailOnAccessError'=>true, 'RequestContentType'=>'application/json'), $user1);



print_r($user1);


}
if($client->exit)
exit;

/*
* Use this script from the command line, so no HTML output is needed.
*/
if($success)
{
if(strlen($client->access_token))
{

var_dump($client);

echo 'The user name is ', var_dump($user1), "\n";
// echo print_r($user, 1);
$response = array('status'=>'success') ;
}
else
{
echo 'The access token is not available!', "\n";
$response=array('status'=>'invalid');
}
}
else
{
//// echo 'Error1: ', $client->error, "\n";
// '<pre>'.var_dump($client).'</pre>';
$response=array('status'=>'error');

}

echo json_encode($response);

?>


i am getting result for the first callapi i.e getting user info.

but i am not able to share or post anthing, can u please help me solve the share iissue.... is my code correct ??

i am not sure whether we can call 2 CALLAPI in one page , because the second share api requires tumber user name there.i

  37. Re: Oauth access token into database   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-11-23 03:34:51 - In reply to message 36 from Prabhulal Ramesh
That is because you are also using the $user variable to get the results of the call to get the blog posts. Use some other variable there.

  38. Re: Oauth access token into database   Reply   Report abuse  
Picture of Prabhulal Ramesh Prabhulal Ramesh - 2014-11-23 04:07:53 - In reply to message 37 from Manuel Lemos
i am using $user1 for the second call api...

i want to post to the wall of the user ,

can u send me some working example to share on user wall....

i am getting first api call result but , second api call (after that a i have printed) says authorisation failed

stdClass Object ( [meta] => stdClass Object ( [status] => 200 [msg] => OK ) [response] => stdClass Object ( [user] => stdClass Object ( [name] => rameshprabhulal [likes] => 0 [following] => 1 [default_post_format] => html [blogs] => Array ( [0] => stdClass Object ( [title] => Untitled [name] => rameshprabhulal [posts] => 0 [url] => http://rameshprabhulal.tumblr.com/ [updated] => 0 [description] => [is_nsfw] => [ask] => [ask_page_title] => Ask me anything [ask_anon] => [followed] => [can_send_fan_mail] => 1 [share_likes] => 1 [likes] => 0 [twitter_enabled] => [twitter_send] => [facebook_opengraph_enabled] => N [tweet] => N [facebook] => N [followers] => 0 [primary] => 1 [admin] => 1 [messages] => 0 [queue] => 0 [drafts] => 0 [type] => public ) ) ) ) )
a
stdClass Object ( [meta] => stdClass Object ( [status] => 401 [msg] => Not Authorized ) [response] => Array ( ) ) {"status":"error"}

  39. Re: Oauth access token into database   Reply   Report abuse  
Picture of Prabhulal Ramesh Prabhulal Ramesh - 2014-11-23 04:22:46 - In reply to message 14 from Justin
hello justin can u please see my code and tell where i am going wrong ?? i have posted both the request and response which i got from tumblr.


Am i missing something to write/post text and link on user wall ???

Just help me out of this error... if u need some more details i can give

  40. Re: Oauth access token into database   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-11-23 04:31:41 - In reply to message 38 from Prabhulal Ramesh
I think the base host name does not include .tumblr.com , so remove it from the API call URL.

 
  1 - 10   11 - 20   21 - 30   31 - 40   41 - 46