node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org ยป



A node.js library for getsatisfaction fastpass (single sign-on)

This serves as a drop-in replacement for the existing getsatisfaction fastpass libraries, and implements the same method signatures (with some defaulting for ease of use) as the ruby library. Documentation for existing fastpass libraries can be found on the getsatisfaction help site.


Add the dependency:

npm install --save fastpass

Require it:

var FastPass = require('fastpass')

Instantiate it:

var fastPass = new FastPass({
   // optional, defaults to ""
   domain : "",
   // required, your consumer key
   consumer_key : "xi2vaxgpp06m",
   // required, your consumer secret
   consumer_secret : "ly68der0hk8idfr5c73ozyq56jpwstd1",
   // optional at instantiation - email of the user
   email : "",
   // optional at instantiation - Name of the user
   name : "Scott",
   // optional at instantiation - unique ID of user (must stay the same for the lifetime the user in your system)
   unique_identifier : "nullstyle",
   // optional boolean, defaults to false
   is_secure : false,
   // optional object, any private fields you like. defaults to {}.
   private_fields : {}


Using the Script tag

  email : "",
  name : "Scott",
  unique_identifier : "nullstyle"
}, function(err,script){
  var outputScript = script

or if you passed name, unique_identifier, and email at instantiation:

  var outputScript = script

Now replace all links to getSatisfaction with calls to GSFN.goto_gsfn()

// for instance, in jQuery
$('body').on('click','a[href=""]',function(){ GSFN.goto_gsfn(); return false; })

Using Cookies along with CNAME

Set a cookie named "fastpass" to the URL generated by the FastPass library. Note: This is only available if your company is using the CNAME feature.

// inside of an express route or whatever:
  cookies["fastpass"] = url

Using the Query String

Include the generated URL in the param named "fastpass" in all links to Get Satisfaction.

// in some template context
  var linkUrl = "<a href="" + url + ">Our Support Community</a>"

Option Details:

Field         |  Required  |  Notes
Key           |    Yes     |
Secret        |    Yes     |
Email         |    Yes     |
Name          |    Yes     |
Unique Id     |    Yes     | Must remain unchanged for the lifetime of the user's account in your system.
Is Secure     |    No      | (defaults to false)
Private Fields|    No      | Key/value pairs to send along with the user to Get Satisfaction.

Example Setup:

The getSatisfaction setup is bi-directional, the smoothest sign on process happens when you have a CNAME set, a cookie with the current user, and a GSFN script on the page after login.

In an express server, here's how that might look:

// Assumes that you've require'd and instantiated FastPass with your credentials.
// a-la: var fastPass = new FastPass(<options>)

// getsatisfaction middleware
// assumes that you've got authentication middleware before this that sets `req.authenticated` and adds `user` to `req.session`.
// these assumptions can obviously be replaced by however your app works, this should get you most of the way there.
    // add a cookie for getSatisfaction single sign on
    // crudely strips the subdomain - probably should be smarter to avoid clobbering non-subdomain urls.
    var cookieDomain ='^[^\.]*',''),
        user = req.session.user
    fastPass.url({name : user.first_name + " " + user.last_name, email :, unique_identifier : },function(err,url){
      // this is the important part - sets a cookie for your domain.
      res.cookie('fastpass',url, {domain : cookieDomain})
  } else {

You'll also need to expose the script on all your logged-in pages:

  var user = req.session.user
  fastPass.script({name : user.first_name + " " + user.last_name, email :, unique_identifier : },function(err,script){
    // do your res.send() or whatever, render the script