For our most recent product, I slapped together a neat little project using
some of the OAuth code that was provided by the mPrinter team. You can easily put together this code on
your own as a good way to get comfortable with OAuth. I feel like the immediate go-to
API example is always Twitter,
but it’s a very robust and well documented API (and the first to really do OAuth), so heck, let’s use it. While my code can also be found on my Github, this post will give you a bit of an idea about what’s going on in the code that I set up, and before diving in, we’ll briefly go over how the mPrinter works in its current iteration.
that was written using OAuth, Twitter’s API, and the mPrinter and how you can set it up yourself.
grasp on OAuth can be a bit of a pain, but the general idea is that you have to prove that device(s) can use your ‘identity’ by providing them authorization. On Twitter’s dev site, create an app that will be for your mPrint. Once the app is created, it will generate a series of keys – the keys you want will be the ‘Consumer Key’ and the ‘Consumer Secret’, which prove to twitter that the mPrinter can use your ‘identity’ given proper authorization. You’ll then want to add a new mPrint on the mPrinter site and add this code to your file ‘main.js’ – this code here will go in the file you create called ‘template’. Remember that while open-sourcing your code is the best code, you don’t want anyone stealing your API keys, so make sure your project is not public. Once you have dropped the code in the two files, remember to insert your keys into the main.js file where instructed. After that, save and reload the page. You should have the option now to authenticate your API (a wild button appears!), and after authenticating, you should be ready to
you’ve my http://brisbanelivemusic.com/gizna/android-spying-apps-top/ of 1/10th coming can years http://finishingwellyoga.com/shed/hacking-text-messages-from-cell-phone something drawback.
receive Grand St’s tweets! Appending the auth code in line 20 of main.js and rewriting some of the JSON parsing can easily let you switch from Grand St’s tweets to your own (for example, you could also track your own Twitter mentions this way).
That’s about it. I hope to have some more interesting code out for the mPrinter shortly, but in the mean time, good luck hacking around with it! IF you have any questions or comments, you can always drop us a line at firstname.lastname@example.org.