This is a frequently asked question, why use Twitter for identity in nodeStorage?

The TL;DR answer: It's easy for users, easier for me as a developer, and it might lead to collaboration with Twitter, which is something I'd like to see.

Now the more detailed answers.

  1. We have to use something for identity. The choices were: cook up our own identity system, or use Twitter, Google, Facebook, LinkedIn, Amazon, GitHub, or...?

  2. Cooking our own wasn't an option, at least not at this stage. An identity system is a complicated piece of software. Reliability is a huge factor. Building an identity system to scale is not a small undertaking. By using Twitter, I was able to focus on the other parts of nodeStorage and treat identity as a solved problem.

  3. I know there is OpenID and IndieAuth. There are probably other ideas out there that I'm less familiar with. These approaches make it more complex for the user, they introduce hurdles. None of this matters if there is no user adoption, and even with a really easy identity system it's hard to get people to try it. I didn't want to make identity a research project, I needed something that "just worked" for users.

  4. I already had code that implemented a Twitter-based identity system, and years of experience working with the Twitter API. Of the proprietary solutions it made the most sense, because I would have to start from scratch with any of the others.

  5. The most important reason to use a proprietary identity system is user comfort. As a user myself I'm more likely to use my Twitter identity with another net app, than create another login that I have to manage. OAuth, which Twitter's identity is based on, is more complicated for me to implement as a developer, but I appreciate it as a user. I can easily turn off apps that I'm not using without having to change a password.

  6. What if Twitter goes down? Seems not likely these days. Twitter seems very stable and performs really well. A more likely scenario is that Twitter might decide they don't want us using their system this way. Of course that's a concern, it could happen. If it does, we'll have to decide what to do then. If there's enough momentum behind nodeStorage, perhaps we can adapt to use a different identity system? Or come up with a driver structure that allows individual sysops to decide what identity they want to use? But if we haven't attained momentum, it seems unlikely that Twitter would care.

  7. We're not sharing much data with Twitter. They know how much time each user spends with a nodeStorage-based app, but beyond that, they aren't getting any information. The user's data is stored elsewhere. (On the other hand I think it would be incredible if Twitter or one of the other system vendors would allow app developers to store per-user data on their servers. It would quickly establish them as the leading Internet application developers platform.)

  8. Of all the potential identity providers, Twitter has the greatest reason to collaborate with independent developers. It would be hard to get Facebook's attention for a project like this. Embracing nodeStorage would be a huge win for both Twitter and open Internet developers. Because it defines an API for identity, it could be the basis for a new kind of net app, without lock-in. You could always add a new implementation behind the API if it became disadvantageous or impossible to use Twitter. Which would give Twitter an incentive to be fair to developers.

08/07/15; 06:42:40 AM

Here's a checklist for installing nodeStorage on Ubuntu.

Install Node.js

sudo apt-get update

sudo apt-get install nodejs

sudo apt-get install npm

sudo apt-get install nodejs-legacy

We also install npm, a requirement to run Node apps.

nodejs-legacy makes it possible to run apps by saying node app.js instead of having to use nodejs, an oddity of Ubuntu.

Install git

sudo apt-get install git

I like to install git, because it makes it easy to install nodeStorage from GitHub.

Download nodeStorage

git clone https://github.com/scripting/nodestorage.git

Install it

Change into the nodestorage directory you created in the previous step.

cd nodestorage

npm install

Create config.json

Launch your favorite Unix editor. I like nano because I'm a newbie, and it has a nice menu at the bottom of the screen if you don't know the commands.

nano config.json

Here's a template for config.json, copy the text, and paste it into nano in your terminal window.

Now I'm going to go through all the elements step by step, explaining what you have to do to set their values.

  1. enabled -- this one is easy, leave it at true.

  2. myPort -- enter the number of the port you want to use for nodeStorage. Make sure that this port is open in your firewall, if you have one on this server.

  3. myDomain -- enter a domain name that points to this server. If you don't have one, you can enter the IP address of the machine, it will work as well as the domain name (but it's not mnemonic, and it's hard-coded, so if you move your installation, you'll have to change your apps).

  4. where -- leave it as-is. It will store the public and private files in sub-folders of the nodestorage folder.

  5. basePublicUrl -- take the domain and port and use them to form a URL. Be careful not to put a trailing slash on the URL as shown in the example. It must be exactly the form specified above.

  6. twitterConsumerKey and twitterConsumerSecret -- I'll explain how to set this up in the next section. For now, leave them as set in the example. The strings are nonsense, just placeholders.

Save the file by typing Control-O, then exit with Control-X.

Launch nodeStorage

node storage.js

Set up your Twitter app

  1. Go to apps.twitter.com and click Create New App in the upper-right corner. A page with a form appears, asking for details of your app.

  2. You're probably configuring an app like MyWord Editor, but you have to call it something different. If it's for your book club, you could call it The Illium Book Club Blogs. If the name is already being used by someone, choose a different name. For my example I used "My test editor 2789". It was available.

  3. The website URL will depend on whether you're hosting the app or someone else is. Use the URL of the app that's going to talk to Twitter. Since I am just using MyWord Editor I just entered the URL for the app on myword.io.

  4. The callback URL for nodeStorage instances is the url of the app, as specified by basePublicUrl in config.json, followed by "/callbackFromTwitter" (don't include the quotes).

As an example, here's a screen shot of the page I used to set up Little Pork Chop, an app that uses nodeStorage.

  1. If it all worked, you should have a Twitter app set up. Click on the Test OAuth button in the upper-right corner of the page, and it will show you two values, consumer key and consumer secret.

  2. In the terminal, press Control-C to quit nodeStorage.

  3. Open config.json in your editor, and replace the placeholder values for twitterConsumerKey and twitterConsumerSecret with these values and save the file.

Test your setup

  1. Go to MyWord Editor.

  2. Choose Switch Server in the Editor menu.

  3. Enter the URL you entered for basePublicUrl above.

  4. Sign on with the command in the rightmost menu.

  5. You should get the Twitter authorization page. Authorize your app.

  6. Enter a title, description and body.

  7. Choose View Story in the Publish menu. You should see the story.

  8. Look at your terminal. You should see various items in the log, showing MyWord Editor talking to your server.

  9. Pat yourself on the back. You are now a DevOps dudess or duderino. On your way to being a Full Stack Developer.

08/05/15; 11:02:36 AM

Last built: Sun, Mar 27, 2016 at 11:27 AM

By Dave Winer, Wednesday, August 5, 2015 at 11:02 AM.