0
這是我的代碼:的OAuth - getAccessToken的tumblr
<?php
session_start();
if ($_GET['oauth_verifier'] && $_GET['oauth_token'])
{
$oauth = new OAuth(
'wvo35DiIDRY5SMfA47OpDDDW958yWckPcs00gFwQdaGtk7e###',
'LvX6zPEtNxZU4sO3BO0V7kkVxI7V0TB6CnSXfIFRKVUdTyQ###',
$_SESSION['oauth_token'],
$_SESSION['oauth_token_secret']
);
$oauth->setToken($_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
$accesToken = $oauth->getAccessToken('http://www.tumblr.com/oauth/access_token'); // ERROR LINE
$oauth->setToken($accessToken["oauth_token"],$accessToken["oauth_token_secret"]);
exit();
}
$oauth = new OAuth(
'wvo35DiIDRY5SMfA47OpDDDW958yWckPcs00gFwQdaGtk7e###',
'LvX6zPEtNxZU4sO3BO0V7kkVxI7V0TB6CnSXfIFRKVUdTyQ###',
OAUTH_SIG_METHOD_HMACSHA1,
OAUTH_AUTH_TYPE_URI
);
$requestToken = $oauth->getRequestToken('http://www.tumblr.com/oauth/request_token');
$_SESSION['oauth_token'] = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
header("Location: https://www.tumblr.com/oauth/authorize?oauth_token={$requestToken['oauth_token']}");
,我有錯誤:
Fatal error: Uncaught exception 'OAuthException' with message 'Invalid auth/bad request (got a 400, expected HTTP/1.1 20X or a redirect)' in
我怎樣才能解決這個問題?
這裏檢查[http://stackoverflow.com/questions/20235182/how-do-i-get-the-access-token-from-tumblrs-official-php-client]它可以幫助您 –
謝謝,但我不使用API Tumblr,我使用這個lib:[Github jaapz Tumblr](https://github.com/jaapz/Tumblr) –