Javascript API ArcGIS Online sign in error

Discussion created by lukestewart-esriuk-esridist on Aug 15, 2012
I am developing an application and trying to use the Portal tools now built into the JS API. I have managed to get it searching ArcGIS Online items and add them to the map but am having issues trying to sign into my organisational account to view private items. I am using the code from the samples (below) to try and sign in. It worked a couple of times but I can now not get it to sign in and have made no changes to the code that would break it. I get the error in the attached image in firebug.
Can anyone shed any light on this?

function signIn() {
      var signInLink = dojo.byId('signIn');
      if (signInLink.innerHTML.indexOf('In') !== -1) {
          portal.signIn().then(function (loggedInUser) {
              signInLink.innerHTML = "Sign Out";
          }, function (error) {
            signInLink.innerHTML = 'Sign In';   //error so reset sign in link
      } else {
        portal.signOut().then(function (portalInfo) {
          signInLink.innerHTML = "Sign In";