Twitter shutting down basic auth June 30

Home Forums Botanicalls Community Twitter shutting down basic auth June 30

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • #1409
    jaredforshey
    Participant

    Sorry if this has been addressed already!

    Twitter is closing basic authentication (used by Botanicalls and basically all Arduino twittering apps) June 30th. Basic Auth means that you log in to twitter by sending it a base-64 encoded has of “Username:Password” in the http header when attempting to post.

    They are requiring everyone to use the much more secure but complicated Open Authentication (OAuth) scheme to use the API. This is a problem because I can’t find any oauth examples for Arduino and it’s too complicated for me to figure out myself.

    Luckily, there’s a site called SuperTweet.net that can do the heavy lifting. You go to SuperTweet, use OAuth to login to twitter, then sign up with Supertweet using a new password. Now you can use basic auth to post to supertweet which in turn uses your stored oauth token to post to your twitter account.

    All you have to do in the source code is change all references to twitter.com to api.supertweet.net and change the twitter IP to 66.180.175.246 (supertweet’s IP). Also, replace the password part of “Username:Password” with your new supertweet password.

    Supertweet makes almost all the API calls available that Twitter has, but with a slight URL change. Most API called now have a /1/ in front. Instead of /statuses/update.xml, the path for supertweet is /1/statuses/update.xml.

    A guy called Neocat over on the Arduino Playground (google it) has a similar service hosted on google’s appspot.com, but in practice we found that it is less straightforward and can be a bit laggy in returning response information. To be fair, we might have been calling it incorrectly!!

    • This topic was modified 2 years, 8 months ago by  Rob Faludi.
    #1757
    jaredforshey
    Participant

    Slight update on the above: the comment I made before about having to add the /1/ isn’t quite correct: the twitter API calls have always had that /1/ at the beginning.

    #1758
    jruys
    Participant

    Can’t get it to work yet. It turns out you have to call the API by its DNS name, not plain IP address like the current leaf code does. I’ve contacted the API provider to see if we can fix it.

    Once I got this working I’ll post the new Arduino sketch to the forum.

    #1759
    jruys
    Participant

    Update: It’s working! I need to clean up the code a bit and document.

    If you’re desperate to test let me know and I’ll send you the beta code offline.

    #1760
    jaredforshey
    Participant

    Twitter pushed off closing down basic auth, but the newer, later deadline is almost here again. August 16 2010 is when the transition happens.

    #1761
    anson
    Participant

    Hey, just to let everyone know I have built a solution to this:

    http://machinetweets.com

    Once you authorize your account you get back a private URL you can post tweets to via a simple HTTP Post. Should be a drop in replacement for any direct auth calls. For example, using CURL would look like:

    curl -d status="My tweet!" machinetweets_url_here

    #1762
    Casaleggio
    Participant

    I am having trouble implementing the SuperTweet workaround.

    Can anyone post the code which need to be changed in order to use this service?

    #1763
    Clemens
    Participant

    Can someone explain what is to do? How can I use Botanicalls now?? What do I have to change? Do I have to flash the device what and where do I have to enter? Has someone tried to use the approach from machinetweets.com with Botanicalls? Would love to keep Botanicalls alive!! Please help!

    #1764
    Kate
    Member

    Do not worry – Botanicalls will continue to live! We will hopefully be posting new version of the Botanicalls software soon, but in the meantime please feel free to share your own revised code in this forum.

    Just a note – due to this update in Twitter’s authentication system, ALL Botanicalls units will need to be reprogrammed. You can read how to reprogram your Botanicalls unit here:

    http://www.botanicalls.com/kits/customize/

    #1765
    botanicalls0084
    Participant

    I understand I will need a USB cable to reprogram the botanicalls unit? Where do I order such a cable? It seems like all your retailers are currently out of stock?

    #1766
    Kate
    Member
    #1767
    botanicalls0084
    Participant

    Once I have one of these cables, what am I supposed to do with them?

    #1768
    Ashok
    Participant

    Any new updates on this? Is there any source code available for using SuperTweet or Machinetweet?

    #1769
    botanicalls0084
    Participant

    please? plants are dying here…

    #1779
    maathieu
    Participant

    Ok guys,

    It is possible indeed to get the “leaf” working using SuperTweet. Since some people seem to have trouble to get it to work, here’s a tutorial compiled by the LOG, Grenoble’s Hackerspace, from many different internet sources, which I tried to quote accordingly.

    Special thanks to Meik Mense for the authentication mod, and to the earlier posters here for the initial pointers to SuperTweet and beyond.

    Of course, we decline all responsibility, yadda yadda yadda. Double-check everything!

    What you will need

    Hardware

    • One FTDI 3.3v cable (can be bought on several online stores). 3.3v is important, maybe 5v will fry your leaf.

    Software

    • Install the Arduino environment suitable to your operating system (download here)
    • Get the Botanicalls Source Code v2.15 (download here)

    Getting started

    1. First of all, you will need to register on SuperTweet. It’s actually easy: go to SuperTweet and login with your Botanicalls twitter account (Botanicalls0XXX) by clicking on “Sign in with Twitter.” Follow the instructions and “Activate” your account. You will be asked to set a new password (different from your twitter account’s password), do so and write it down – you’ll need it later.
    2. Then, unplug your leaf from the power supply and plug it in the FTDI cable, following the instructions of the Customize page of this website. Holding the leaf upwards (network connector going towards the ground), the connector should be plugged on the pins that are on the right of the board. There is a small “blk” marking at the bottom and it should be matched to the black wire of the connector.
    3. Then, plug the USB end of the FTDI cable into your computer. You’ll see your leaf blinking and it’s going to go live again.
    4. Unzip the source code you got earlier in a convenient directory.
    5. Finally, start the Arduino environment and open the said source code (File > Sketchbook > Open…)

    Modify the code

    Until Botanicalls integrates those modifications into a new firmware, you will need to patch the code manually. Here’s what you need to edit:

    In BotanicallsTwitter:

    At line 8 replace:

    #define VERSION "2.15" // initial leaf board

    by:

    #define VERSION "2.15c" // initial leaf board

    (this will be useful later)

    At line 12 change:

    #define USERNAMEPASS "username:password" // your twitter username and password, seperated by a :

    And put in your Twitter username and the password you defined in SuperTweet (NOT your Twitter password!).

    At line 54 change the IP address:

    #define IPADDR "128.121.146.100" // twitter.com

    becomes

    #define IPADDR "66.180.175.246" // api.supertweet.net

    At line 56 replace:

    #define HTTPPATH "/statuses/update.xml" // the person we want to follow

    by

    #define HTTPPATH "/1/statuses/update.xml" // the person we want to follow

    And finally uncomment the two lines 121 and 122:

    // uint8_t response = posttweet("Botanicalls!"); // send a startup message to Twitter

    // notify(response);

    so you get:

    uint8_t response = posttweet("Botanicalls!"); // send a startup message to Twitter

    notify(response);

    This will allow for immediate testing.

    In checks:

    At line 111 replace:

    char *str3 = "%";

    by

    char *str3 = "%25";

    This is to correct a bug (strings should be urlencoded).

    in twitter:

    Replace line 167 and following:

    // next, the authentication

    putstringSS("Host: ");

    putstringSS_nl(IPADDR);

    putstring("Host: ");

    putstring_nl(IPADDR);

    putstringSS("Authorization: Basic ");

    putstring("Authorization: Basic ");

    mySerial.println(linebuffer);

    Serial.println(linebuffer);

    putstringSS("Content-Length: ");

    mySerial.println(7+strlen(tweet), DEC);

    putstring("Content-Length: ");

    Serial.println(7+strlen(tweet), DEC);

    putstringSS("nstatus=");

    mySerial.println(tweet);

    putstring("nstatus=");

    Serial.println(tweet);

    by the following:

    // next, the authentication

    putstringSS_nl("Host: api.supertweet.net");

    putstring_nl("Host: api.supertweet.net");

    putstringSS("Authorization: Basic ");

    putstring("Authorization: Basic ");

    mySerial.println(linebuffer);

    Serial.println(linebuffer);

    putstringSS_nl("Content-Type: application/x-www-form-urlencoded");

    putstring_nl("Content-Type: application/x-www-form-urlencoded");

    putstringSS("Content-Length: ");

    mySerial.println(7+strlen(tweet), DEC);

    putstring("Content-Length: ");

    Serial.println(7+strlen(tweet), DEC);

    putstringSS("nstatus=");

    mySerial.println(tweet);

    putstring("nstatus=");

    Serial.println(tweet);

    Credits to Meik Mense for the info (found here).

    Compile and test

    OK, now you’re done with the changes. What you need to do is threefold:

    1. CHANGE the BOARD by going in the Tools > Board menu and choose “Arduino Diecimila or Duemilanove w/ ATMega 168
    2. Click the “Verify” button (it’s the disk-shaped arrow button).
    3. If it doesn’t show any errors (you’ll get a “Binary Sketch size:…” message), click the “Upload to IO Board” button.
    4. If you get an error message during the upload, click the button again, wait for two seconds, then press the “reset” button of the leaf (it worked for me – see here for more info if you experience issues).
    5. If the upload is OK (no errors), click the “Serial Monitor” button. Wait for a while, the leaf initializes and then it will print “Botanicalls v2.15c”. If there is no “c” at the end, then it didn’t upload the new firmware correctly :(.
    6. Open Twitter and go to your Botanicalls account. You should see a new Tweet: “Botanicalls!”

    If you get the “Botanicalls!” message above, then it’s ok, your leaf is now twittering through Supertweet. You can then unplug your USB cable, the FTDI cable and afterwards plug in your power supply, and your leaf is autonomous again.

    Troubleshooting

    If it doesn’t work, make sure to check the following:

    First, press the “test” button, wait for ten-ish seconds, and refresh your twitter page. It should print the moisture level. Apparently, the “Botanicalls!” twitter printout will only work once every day (Twitter spam restrictions), so you need a different message, and the “test” button does just that.

    • Did you use the Twitter password or the SuperTweet password in your code? (hint: use the SuperTweet password)
    • Did you manage to upload the new code? (test by resetting your leaf and see if it prints “2.15c” in the Serial Monitor
    • Is your SuperTweet account active?

    Aftermath

    Botanicalls devs, I hope you’ll update your code soon enough with this info (or base yourself on it), because it’s a great project you have here and it would be nice to see it alive again. There are a few more things to do in the code IMHO, I didn’t have enough time for that:

    1. Finish the URLencoding: all the “space” characters should be coded with “+” or “%20”. It works without it, but it should be corrected.
    2. Change the “Botanicalls!” initial tweet so that it shows a random string (Botanicalls!whatever) at every reset. Would be useful for testing.
    3. Recode the “twitter” stuff so that it doesn’t hardcode the URL in the auth data (will ease portability to other third parties services)

Viewing 15 posts - 1 through 15 (of 26 total)
  • You must be logged in to reply to this topic.


New kits are here!

Categories

Pothos Plant Tweets

    Flickr Feed

    www.flickr.com
    More photos or video tagged with botanicalls on Flickr

    Meta