Do i need access_token_secret when i creat signature in obtainning a request token at the beginning?


#1

if I need, then how could i get one?


#2

me too have d same pblm…

if (T.isConnected()) {
currentUser = T.currentUser;
screenName = currentUser.data(‘screen_name’);
profileImage = currentUser.data(‘profile_image_url’);
}
does it requires Consumer secret
how can i giv it, and retrive details using php
Thank you


#3

i am getting an error when using above fn,ie.TypeError: currentUser is undefined
and the isConnected fn doesnt work
does it all requies Consumer secret…

hw can i use these functions
T.bind(“authComplete”, function (e, user) {

});

T.bind("signOut", function (e) {
  // triggered when user logs out
});

#4

hummm, as a beginner to twitter api, i only know that:
1, it must need cosumer secret and oauth token secret when u making signature in sending request
2,and if u r using javascript, u should define currentUser like: var currentUser = T.currentUser;
3,idk what’s exactly in T.isConnected(), so maybe u should check the source first
4,complete those function with ‘authComplete’ or ‘signout’ trigger, humm, would trigger those function when user doing that i guess


#5

hw can i access details in authComplete using php?
thank you


#6

twttr.anywhere(function (T) {
T.signIn({
T.linkifyUsers();
authComplete: function(user) {
var currentUser,
screenName,
profileImage;
currentUser = T.currentUser;
screenName = currentUser.data(‘screen_name’);
profileImage = currentUser.data(‘profile_image_url’);
//ajax call to save details
//on sucess window.location= “xyz”;

},
signOut: function() {
// triggered when user logs out
}
});

});

wt i am missing!!!


#7

idk, that’s what im asking, lol, might tell u after i get thoese thing clear


#8

don’t know what r u using… r u using oauth.js or other platform?


#9

anywhere.js


#10

here is a php script of get method

<?php //readQuery $path=explode('?',rawurldecode($_POST['path'])); $url=$path[0]; $getParament=$path[1]; $token=""; $token_secret=""; if($_POST['token']){ $token=$_POST['token']; } if($_POST['token_secret']){ $token_secret=$_POST['toke_secret']; } //postParament //collectStuff $consumer_secret="ur consumer secret"; $consumer_key="ur consumer key"; $timestamp=time(); $signature_method="HMAC-SHA1"; if($_POST['signature_method']){ $signature_method=$POST['signature_method']; } $chart="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; $nouce = substr( str_shuffle($chart),0,42); $version = "1.0"; //build baseString $baseString = "${getParament}&oauth_consumer_key=${consumer_key}&oauth_nouce=${nouce}&oauth_signature_method=${signature_method}&oauth_timestamp=${timestamp}&oauth_token=${token}&oauth_version=${verson}"; $baseString = rawurlencode($baseString); $eurl = rawurlencode($url); $baseString = "GET&${eurl}&${baseString}"; //signature $s_key = "${consumer_secret}&${token_secret}"; $signature = base64_encode(hash_hmac("sha1",$baseString,$s_key)); //buildheadString $h = array(); $h[Authorization]="OAuth oauth_consumer_key=\"${consumer_key}\",oauth_nouce=\"${nouce}\",oauth_signature=\"${signature}\",oauth_signature_method=\"${signature_method}\",oauth_timestamp=\"${timestamp}\",oauth_token=\"${token}\",oauth_version=\"${version}\""; //get&post $url = sprintf("%s?%s",$url,$getParament); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_HTTPGET,true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch,CURLOPT_HTTPHEADER,$h); $data = curl_exec($ch); if ($data === false) { header('HTTP/1.1 400 Bad Request'); exit; } else { echo $data; } ?>

u put it in ur server, and using post method in xmlhttprequest
the data u r sending should be like: "path=apiurl with ur get parament&token= access token&token_secret=access token secret"
put ur xmlhttprequest.onstatechange function below this line in authComplete://ajax call to save details
then check ur result


#11

authComplete doesn’t work

“NetworkError: 403 Forbidden - https://si0.twimg.com/a/1353007665/javascripts/anywhere/base_lite.js

“NetworkError: 500 Internal Server Error - https://oauth.twitter.com/2/authorize

these r d errors i am gettng


#12

curl doesnt work in my server


#13

It looks like you’re trying to use the deprecated @Anywhere framework which will cease functioning next month. I don’t recommend developing with it. There are no pure client-side Javascript implementations that will work with the Twitter API 1.1.