Comments (15)
Does https://api.tumblr.com/console not give you what you are looking for here? You should see implementations in your language of choice and give you back some tokens.
from tumblr.php.
When I use the console, it only gives me tokens to access my own blog. I want to be able to authenticate a user and show their own dash. That way anyone can view their own blog feed.
from tumblr.php.
@austinkregel https://github.com/tumblr/tumblr.php/wiki/Authentication ! :)
Hope that helps!
from tumblr.php.
It doesn't help. It far from helps. A link to my sample page is below... It takes FOREVER to make the requests, and for me that is unacceptable. I'm sure that there is another way to make requests without them taking as long as they do.
I copied and pasted the Authentication page, and replaced the key and secret that I needed to.
Link: http://embb.pw/unus/__core/tumblr-manager.php
from tumblr.php.
@austinkregel have you done any kind of benchmarking to see what part of the process is actually holding up here? A slow loading page can be any number of various things.
We need a little bit more if we're going to help you on why it's taking so long to do anything. :)
Thanks!
from tumblr.php.
I will download, install, setup, and let you know the results of a benchmark. I have honestly never done a benchmark because I didn't know you could do it for php.
from tumblr.php.
@codingjester Okay so I have a nice debug tool here, according to my results.
Retrieving the access token, is taking quite a while. ( I used the time(); function in php)
Log time:1410289909. current time: 1410289970
After all that happens I get to the part at the end of the script where I try to create the new Tumblr\API\Client
and it errors out saying I don't have access.
Fatal error: Uncaught Tumblr\API\RequestException: [401]: Not Authorized thrown in /tumblr-php/lib/Tumblr/API/Client.php on line 427
from tumblr.php.
@austinkregel can you post a gist of the code you're currently working on without your consumer key and secret. That way I can kinda grok exactly what you're doing right now with the script.
Thanks :)
from tumblr.php.
@codingjester you can see the gist here https://gist.github.com/austinkregel/4c7564a9dc1d72754934
from tumblr.php.
@codingjester I don't know if you will be able to see the log in the developer console if you try the demo. Here is the one I keep getting.
We have set the base url, the key and secret.
Now we make the request log.js:137
Log time:1410291199. current time: 1410291199
request made!
Log time:1410291199. current time: 1410291200
parsed the request!
Log time:1410291199. current time: 1410291200
now we authorize!
Token authorized!!
Log time:1410291199. current time: 1410291200
Requesting access token
Log time:1410291199. current time: 1410291260
Requesting access token.
Log time:1410291199. current time: 1410291260
Access token set.
Log time:1410291199. current time: 1410291260
getting user info.
from tumblr.php.
@codingjester @seejohnrun Is there anyway I can do authentication without using it as a CLI script?
from tumblr.php.
@austinkregel
I commented on the gist but also posting here. Try this code & run from your website in browser.
session_start();
require_once('vendor/autoload.php');
$consumerKey = 'XXX';
$consumerSecret = 'YYY';
$client = new Tumblr\API\Client($consumerKey, $consumerSecret);
$requestHandler = $client->getRequestHandler();
$requestHandler->setBaseUrl('https://www.tumblr.com/');
// If we are visiting the first time
if (!$_GET['oauth_verifier']) {
// grab the oauth token
$resp = $requestHandler->request('POST', 'oauth/request_token', array());
$out = $result = $resp->body;
$data = array();
parse_str($out, $data);
// tell the user where to go
echo '<a href="https://www.tumblr.com/oauth/authorize?oauth_token=' . $data['oauth_token'].'"> GO </a>';
$_SESSION['t']=$data['oauth_token'];
$_SESSION['s']=$data['oauth_token_secret'];
} else {
$verifier = $_GET['oauth_verifier'];
// use the stored tokens
$client->setToken($_SESSION['t'], $_SESSION['s']);
// to grab the access tokens
$resp = $requestHandler->request('POST', 'oauth/access_token', array('oauth_verifier' => $verifier));
$out = $result = $resp->body;
$data = array();
parse_str($out, $data);
// and print out our new keys we got back
$token = $data['oauth_token'];
$secret = $data['oauth_token_secret'];
echo "token: " . $token . "<br/>secret: " . $secret;
// and prove we're in the money
$client = new Tumblr\API\Client($consumerKey, $consumerSecret, $token, $secret);
$info = $client->getUserInfo();
echo "<br/><br/>congrats " . $info->user->name . "!";
}
from tumblr.php.
YES! Thank you! That works better than I could hope. It's super quick to. @khurshid-alam you're awesome.
from tumblr.php.
Thanks..glad I could help.
from tumblr.php.
Thanks @khurshid-alam I was just about to code up an example myself :D
from tumblr.php.
Related Issues (20)
- Response to a Submission HOT 1
- followed
- Tumblr oauth not working in Laravel 6.5.2
- Encountere a error during handling Response in PHP HOT 1
- Encountered an Exception handling HOT 1
- How to check if a post is reblogged ?
- Is this package deprecated? HOT 6
- Is there a version of this package that supports NPF(Neue Post Format)?
- Missing or invalid request token. HOT 1
- Neue Post HOT 5
- compatibility issue with php8.2 HOT 1
- Bad request code 8009
- Bad Request (You may only upload one video per post.) HOT 1
- RATE LIMITING HEADERS HOT 1
- Rate limit exceeded HOT 1
- Reblog post Unauthorized ? HOT 1
- oauth 403 error ? HOT 2
- some blogs returns 404 HOT 11
- How to get video post URL HOT 3
- get list of users who liked post
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tumblr.php.