jublo / codebird-js Goto Github PK
View Code? Open in Web Editor NEWA Twitter library in JavaScript.
Home Page: https://www.jublo.net/projects/codebird/js
License: GNU General Public License v3.0
A Twitter library in JavaScript.
Home Page: https://www.jublo.net/projects/codebird/js
License: GNU General Public License v3.0
Hello and thank you for your work.
Trying to favorite a post does NOT work:
cb.__call("favorites_create", {
"id": "362614359207329800"
}, function (reply) {
console.log('Favorite response')
console.log(reply);
});
Returns error message:
https://api.jublo.net/codebird/1.1/favorites/create.json
Object {errors: Array[1], httpstatus: 404}
errors: Array[1]
0: Object
code: 34
message: "Sorry, that page does not exist"
proto: Object
length: 1
proto: Array[0]
httpstatus: 404
Am I missing something? or you will implement this later?
Thanks and regards,
Walter
i have an issue with ie7-9. i do an authentication server side and when i make a call to 'users_lookup' i get a js error: SCRIPT1004: Expected ';' on returned json. it might be a Twitter issue, but may be someone else have found a solution. unfortunately i have to use ie.
it works fine with other api calls (friends_ids)
statuses_userTimeline returning error "Failed to load resource https://api.jublo.net/codebird/1.1/statuses/user_timeline.json?screen_name=adityapratap270&count=20
Also I tried
objTwitterCB.__call(
"oauth_requestToken",
{oauth_callback: "oob"},
function (reply) {
// stores it
objTwitterCB.setToken(reply.oauth_token, reply.oauth_token_secret);
console.log(reply);
// gets the authorize screen URL
objTwitterCB.__call(
"oauth_authorize",
{},
function (auth_url) {
window.codebird_auth = window.open(auth_url);
}
);
}
);
It returned an error 👎
Whoa there!
There is no request token for this page. That's the special key we need from applications asking to use your Twitter account. Please go back to the site or application that sent you here and try again; it was probably just a mistake.
Codebird doesn't recognize the palce_id paramter.
Following the documentation to access geo/id/:place_id
We should call geo_id_PLACE_ID
But it is translated into geo/id/:place/_i_d
Hey guys,
what could be the problem when trying "statuses_updateWithMedia". I get
The requested URL /codebird/1.1/statuses/update_with_media.json was not found on this server. "httpstatus":404}
In addition to the API methods publicly documented, the Twitter API also supports undocumented API methods, often for use by internal or official apps. Codebird may support them (or part of them).
I guess may of you today started experiencing problems with Codebird due to the fact that the proxy, api.jublo.net, is down.
Is there a way to point the library directly to the twitter.com servers and avoid the proxy altogether?
API parameters with special characters are double-escaped when using JSONP.
{screen_name: "myx,mynetx"}
becomes
...&screen_name=myx%252Cmynetx
...
Correct result would be
&screen_name=myx%2Cmynetx
I'm fairly new to the Twitter API 1.1, so this could be the wrong solution to the problem.
When trying to call 'statuses_show', I was getting the error "Uncaught ReferenceError: c is not defined " meaning that httpmethod was not in the array httpmethods['GET'].
I tried using the parameter "statuses_show_:id" to satisfy the httpmethods array in the plugin (line 800), but then I was getting Code 34 (Sorry, that page does not exist) from Twitter. This was because the url the plugin was generating was: https://api.jublo.net/codebird/1.1/statuses/show/:id.json?id=333746084075692032 and according to the API docs, ":id" shouldn't be included in the url.
However, if I changed 'statuses/show/:id' to 'statuses/show/' (just removed ":id") that fixed the problem.
I'm thinking that the ":id" shouldn't be in any of the array items at all.
Thanks for this plugin! It makes API calls so much easier! Just had this one little issue.
Streaming API. That means, you call the API server once and get back a continuous stream of data, running as long as you wish. Unfortunately, web browsers today do not fully support the necessary WebSockets API, as you can see on this graph.
When defining the function _clone(obj) , line 806 has (what I believe is) a recursive call to the same function in the event that the data member of the object being clone is itself an object.
I believe that that there is a typo bug on line 806, instead of having a _clone(obj) function call, line 806 has a call to clone(obj). PLEASE NOTE the absence of the underscore( _ ) .
clone() function is NOT DEFINED anywhere in codebird.js .
At present code.js works fine but I believe this typo bug will cause future problems in the event that a recursive call is ever made by the code in line 806
Codebird.js should pass JSHint validation, as prove for high-quality code.
Hi Everyone,
This is not a bug as the code and codebird script are working fine, but I've noticed that the popup when requesting Twitter's pin is blocked by Chrome and IE, as this is a callback call from the login button clicked and not a direct call from the login button. Is there a way to avoid this popup to be blocked?
Here's basically my code:
In HTML:
A button calling Tlog() onclick.
In JS:
Tlog = function () {
// gets a request token
cb.__call("oauth_requestToken", {
oauth_callback: "oob"
}, function (reply) {
cb.setToken(reply.oauth_token, reply.oauth_token_secret);
// gets the authorize screen URL
cb.__call("oauth_authorize", {}, function (auth_url) {
//HERE'S THE POPUP BLOCKED
window.codebird_auth = window.open(auth_url);
$('#TLogin').hide();
$('#TPinField').prepend('<p>Enter the PIN received from Twitter and click on "Validate PIN"</p>');
$('#TPinField').show();
$('#TPinButton').show();
});
});
}
I would appreciate any advice.
Thanks and a great day.
Walter
Running this from Win7 desktop Firefox 27.0.1 code is here:
Copied and pasted the code from codebird.js so last revision https://github.com/jublonet/codebird-js/blob/3b9dddee624fc07934685ad6b5084ead802ca299/codebird.js
var cb = new Codebird;
cb.setConsumerKey("AjONvgAdbD8YWCtRn5U9yA", "jrcJKxvJ92NeeV48RL1lotN9PigbxCCbqUkKj237yio");
cb.setUseProxy(false);
// gets a request token
cb.__call(
"oauth_requestToken",
{oauth_callback: "oob"},
function (reply) {
// stores it
cb.setToken(reply.oauth_token, reply.oauth_token_secret);
// gets the authorize screen URL
cb.__call(
"oauth_authorize",
{},
function (auth_url) {
window.codebird_auth = window.open(auth_url);
}
);
}
);
Instead of the authorize page it leads you to a twitter page saying
Whoa there!
There is no request token for this page. That's the special key we need from applications asking to use your Twitter account. Please go back to the site or application that sent you here and try again; it was probably just a mistake.
To avoid external dependencies and not-included helper files, the hashing function SHA1 should be integrated into Codebird itself, instead of a separate file sha1.js
.
What does this error mean? I do not use a proxy. It is a completely JavaScript based tool I am developing and I don't want to use PHP. Thank you
OPTIONS https://api.jublo.net/codebird/oauth2/token codebird.js:516
oauth2_token codebird.js:516
_callApi codebird.js:1184
(anonymous function) codebird.js:1185
xml.onreadystatechange
Codebird should contain a test suite for finding regressions and hidden bugs. The test suite should run in the browser, for example via Jasmine.
Codebird supports authenticating via OAuth and xAuth. The README should contain a section about xAuth. Can be adopted from codebird-php.
I am trying to destroy a status using statuses/destroy/:id (statuses_destroy_ID also using id_str as the id). I consistently receive a 403 with the message of "{"errors":[{"message":"Your credentials do not allow access to this resource","code":220}]}". I have read and write access set up for my app.
I am able to successfully retrieve the timeline and update the status.
I noticed that the successful status update is using OAuth for x-authorization where as the 403'd status destroy is using Bearer as the x-authorization.
I am running @Version 2.3.3.
By the way, thank you for your work on this great library!
Looks as if jublo.net is down all together. Any chance this will be fixed?
Can't get it working from nodejs command-line script. Getting error:
xml = new ActiveXObject("Microsoft.XMLHTTP");
^
ReferenceError: ActiveXObject is not defined
Hi guys,
Thanks for your great library! I am having an issue with Internet Explorer while trying to get application-only auth:
cb = new Codebird();
cb.setConsumerKey('key', 'secret');
cb.__call('oauth2_token', {}, function(reply) {
console.log(reply)
});
Result: Access denied
On some old versions of Internet Explorer the dev tools direct me towards the line 485 of the library:
var xml;
try {
xml = new XMLHttpRequest();
} catch (e) {
xml = new ActiveXObject("Microsoft.XMLHTTP");
}
xml.open("POST", url, true);
I thought it might be related to the following: http://stackoverflow.com/questions/5087549/access-denied-to-jquery-script-on-ie
Do you have any suggestions? Thanks a lot for your help!
Can I not authenticate using an actual auth_callback url without having to do oob?
Also, why are the requests going to: https://api.jublo.net/codebird/oauth/request_token
rather than directly to twitter?
I would prefer a better documentation, also with completet but easy programming examples, like an easy website for a twitter stream of an user and with example tokens. So that everybody can copy&paste this website, replace the tokens and then run the website.
function twLogin() {
cb.setConsumerKey("KEY", "SECRET");
var id;
// check if we already have access tokens
if(localStorage.accessToken && localStorage.tokenSecret) {
// then directly setToken() and read the timeline
cb.setToken(localStorage.accessToken, localStorage.tokenSecret);
// now poll periodically and send an auto-reply when we are mentioned.
//fetchTweets(id);
} else { // authorize the user and ask her to get the pin.
cb.__call(
"oauth_requestToken",
{oauth_callback: "http://www.neilmarion.com"},
function (reply) {
// nailed it!
console.log(reply);
cb.setToken(reply.oauth_token, reply.oauth_token_secret);
cb.__call(
"oauth_authorize", {},
function (auth_url) {
var ref = window.open(auth_url, '_blank', 'location=no'); // redirection.
// check if the location the phonegap changes to matches our callback url or not
ref.addEventListener("loadstart", function(iABObject) {
if(iABObject.url.match(/neilmarion/)) {
ref.close();
authorize(iABObject);
}
});
}
);
}
);
}
}
function twTweetLink(fileName) { // not a photo upload. Just merely a tweeting of a public link
var url = "http://www.testphotorestapi.neilmarion.com/avatars/"+fileName;
cb.__call("statuses_update",
{"status": "This is a test. " + url}, function (reply) {
console.log(reply);
});
}
Whenever I call twLogin, the user seems to be authenticated properly - a inAppBrowser pops up that shows the "authenticate" app form. But I'm trying to call twTweetPhoto, nothing's happening. No tweet being updated in my feed.
What could be the problem here?
This started a couple of hours ago.
Using Codebird in browsers is subject to the Same Origin Policy. Adding support for JavaScript callbacks using JSONP will help circumvent this issue.
How can i get an access token/secret after getting the oauth_token and oauth_verifier in callback url (http://mydomain?oauth_token=blah&oauth_verifier=blah). Trying to do it from your example but without PIN.
Thanks.
Anyone else experiencing the same issue?
The CORS proxy should only be used for browsers that have the same-origin policy. Node.js and other non-browser environments (any that do not define the navigator
object) should use direct connection to the API.
The Asynchronous Module Definition (AMD) API specifies a mechanism for defining modules such that the module and its dependencies can be asynchronously loaded. This is particularly well suited for the browser environment where synchronous loading of modules incurs performance, usability, debugging, and cross-domain access problems.
Codebird should support getting loaded either as vanilla file or as an AMD module.
Adding some first steps (alike the ones in codebird-php/README) will greatly help new users.
The first 2 times i used the API call it worked just fine, but after that without making any changes, the response from the call takes between 30 seconds to 2 minutes to arrive.
Any ideas what could be the issue?
Due to the "rudimentary" comparison mechanism, detectMultipart returns true for status/update for example. I would suggest simply creating an object with the method calls as keys, and checking later if a given key exists.
https://api.jublo.net/codebird/oauth/request_token is currently giving error
Hi all
I have run https://api.jublo.net/codebird only show
Parent Directory
cacert.pem
codebird-cors-proxy.php
not have 1.1
Please confirm help me
thank
SEE ERROR 42...
#42
POST https://api.jublo.net/codebird/oauth2/token 404 (Not Found)
api.jublo.net/codebird/oauth2/token:1
oauth2_token
_callApi
(anonymous function)
xml.onreadystatechange
hello same code not working on ios
It was working fine yesterday but today start getting a 404 @ https://api.jublo.net/codebird/oauth/request_token
Hello All,
I'm trying to access https://api.jublo.net/codebird/1.1/statuses/user_timeline.json?screen_name=twitter&trim_user=1&count=10&include_rts=0&page=1 using CodeBird 2.5.0-dev but it's not working, are we experiencing a server down issue here?
Thanks in Advance..
Hi!
I have been trying to use the library but I could not...
Can someone provide me a simple Twitter authentication code please?? I always receive a 401 ERROR...
Thank you very much!
This code should work:
var params = {
screen_name: "twitter"
};
cb.__call(
"statuses_userTimeline",params,
{},
function (data) {
console.log(data);
}
But i dont get any error messages and the request is empty.
When I use cb.setUseProxy(false) I recieve "HTTP/1.1 405 Method Not Allowed", when I have look at request it was "OPTIONS /oauth/request_token HTTP/1.1", but I need "POST /oauth/request_token HTTP/1.1". In documentation there are no words about how to specify method customly.
Unable to connect to the proxy this morning.
Someone else meets this problem?
Thanks,
Walter
cb.__call(
"directMessages_destroy",
{"id" : val.id },
function (reply) {
}
);
Results in:
POST https://api.jublo.net/codebird/1.1/direct_messages/destroy.json 404 (Not Found)
Hi all
I have using codebird.js 2.4.3 . I login authentical ok but when I statuses_update show error invalid or expired token code 89 . this my code
var cb = new Codebird;
function loginTwitter(){
cb.setConsumerKey(mykey, mysecret);
cb.__call(
"oauth_requestToken",
{},
function (reply) {
// stores it
token = reply.oauth_token;
token_secret=reply.oauth_token_secret;
cb.setToken(token, token_secret);
// gets the authorize screen URL
cb.__call(
"oauth_authorize",
{},
function (auth_url) {
window.codebird_auth = window.open(auth_url);
}
);
}
);
}
function tweet(){
var msg= $("#Tweetwall").val();
cb.setConsumerKey(mykey, mysecret);
cb.setToken(token,token_secret);
// alert(token.trim());
// alert(token_secret);
// alert(msg);
cb.__call(
"statuses_update",
{"status": msg},
function (reply) {
//alert(enumerateObject(reply.errors[0]));
// alert("tweet to wall");
}
);
}
please relpy help me. thank
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.