CyberNotes: Switch Between Multiple Site Logins

This article was written on January 23, 2008 by CyberNet.

CyberNotes
Web Browser Wednesday

There was a lot of excitement when we wrote about the Greasemonkey script that could be used to switch between multiple Gmail accounts. At that time Thilak commented about a Firefox extension that basically accomplished the same task. With it you create user profiles that you can switch between, and it uses a different set of cookies for each of the profiles.

Since most sites store session information in cookies this is a good method for switching between multiple accounts, whether it be for email, shopping, or just about anything. That’s when it hit me that you can manipulate cookies using JavaScript as well, and I figured there had to be a way to create a bookmarklet to do almost the same thing as the extension.

Before we dive into the bookmarklet lets take a look at the Firefox extension more in depth:

–Firefox Extension–

CookieSwap The extension is called CookieSwap, and once installed you can create multiple profiles that can be used to manage different identities from around the web. They are all controlled from the Status Bar where you can select which identity you want to use.

This is great for switching between multiple email accounts without needing to login to each one, as well as making it easier for several different people to all use the same browser. For example, each person in your family could have their own profile, and then each of them wouldn’t have to constantly bother with logging in and out of websites.

The good news is that all of your information is stored in a cookie, which ensures that no one can see your password in plaintext. Well, that’s at least the case for sites that are designed properly.

One downside that I’ve found to using this is that there’s no way to restrict the cookie swapping to a particular site. The first time you create a new profile you’ll start with a blank slate, and you’ll need to go login to all the sites you want enabled for that particular profile. So it may not be the optimum solution if all you want to do is switch between several different accounts on one particular site.

–Bookmarklet–

Huh?: A bookmarklet is a small JavaScript program that can be stored as a URL within a bookmark in most popular web browsers, or within hyperlinks on a web page.

We figured there had to be a way to create a bookmarklet to swap between cookies as well, but on a per site basis. As always we didn’t want to reinvent the wheel if we didn’t have to, so we searched around to see what we could find. Jesse Ruderman came to the rescue with a bookmarklet that he wrote to transfer cookies from one browser to another. We took that bookmarklet, modified it a bit, and created something that we think you’ll enjoy.

Here’s how it works. First you’ll need to drag this link into your bookmarks, or right-click on it and select the bookmark option:

Backup Cookies

Now head on over to the site you want to “backup” the cookies for. Click on the bookmarklet you just created, and you should see something like this:

Bookmarklet Swap Cookies

Bookmarking that will store your existing cookies for that site in the form of a bookmarklet. To restore the particular cookies for the site just run that bookmarklet.

Important: You must be on the site corresponding to the bookmarklet before running it. Otherwise your the cookies will not be updated. For example, if you backed up your Yahoo! cookies make sure you are on the Yahoo! website before running the bookmarklet.

In the example pictured above I was logged into Yahoo!, I ran the “Backup Cookies” bookmarklet to save my existing cookies. I was then able to logout of Yahoo! and run the new bookmarklet to restore all of my login credentials. It’s really that simple.

It’s pretty cool how something as simple as cookies can be used to restore your login status, but it’s something you also want to be careful with. Doing this would also mean that if the information ended up in the wrong hands that it could do some severe damage. For security reasons I recommend that you be especially cautious if you synchronize your bookmarks with a third-party online service.

Hat tip to Thilak for pointing out the Firefox Extension!

Copyright © 2011 CyberNetNews.com

Related Posts:


No Responses to “CyberNotes: Switch Between Multiple Site Logins”

Post a Comment