Git Product home page Git Product logo

Comments (2)

ceyko avatar ceyko commented on August 20, 2024 1

@dimisus I believe you're just missing a trim() on your oauth_verifier. I constructed a more minimal version of your code and can successfully complete the OAuth flow:

// Setup
$client = new Tumblr\API\Client('...','...');
$requestHandler = $client->getRequestHandler();
$requestHandler->setBaseUrl('https://www.tumblr.com/');

// Request Token
$resp = $requestHandler->request('POST', 'oauth/request_token', array());
$request_tokens = array();
parse_str($resp->body, $request_tokens);
$client->setToken($request_tokens['oauth_token'], $request_tokens['oauth_token_secret']);

// Authorization
echo 'https://www.tumblr.com/oauth/authorize?oauth_token=' . $request_tokens['oauth_token'] . "\n> ";
$stdin_handle = fopen('php://stdin', 'r');
$oauth_verifier = trim(fgets($stdin_handle));

// Access token
$resp = $requestHandler->request('POST', 'oauth/access_token', array('oauth_verifier' => $oauth_verifier));
$access_tokens = array();
parse_str($resp->body, $access_tokens);
$client->setToken($access_tokens['oauth_token'], $access_tokens['oauth_token_secret']);

// Validate
$requestHandler->setBaseUrl('https://api.tumblr.com/');
echo $client->getUserInfo()->user->name . "\n";

from tumblr.php.

vitor-mariano avatar vitor-mariano commented on August 20, 2024

I didn't understand you code. Try to refactor your code following this doc. https://github.com/matheusmariano/tumblr.php/blob/improving-docs/README.md

from tumblr.php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.