Update data in a factory

Hi guys,

In my app, I use the facebook connect API.

I store the userID in localstorage, I need the userID to display data, data that concerns each user.

In my case, I need to update the userID in a factory in the case where the user might want to change of facebook account.

Here is my factory :

app.factory('FavoritesArtists',['$http', '$q', 'UserService', function($http, $q, UserService){
  var deferred = $q.defer();
  var userId = UserService.getUser().userID;
  console.log('FavArtistsFactory '+userId);

      .success(function(data) {
 .error(function(err) {
  return deferred.promise;

I need this variable to update :
var userId = UserService.getUser().userID;

UserService.getUser().userID is in localstorage

Here is the code :

app.factory('UserService', function() {

    var setUser = function(user_data) {
        localStorage.starter_facebook_user = JSON.stringify(user_data);

    var getUser = function(){
        return JSON.parse(localStorage.starter_facebook_user || '{}');

    var clearData = function(user_data){
        localStorage.starter_facebook_user = JSON.stringify(user_data);

    return {
        getUser: getUser,
        setUser: setUser,
        clearData: clearData

For now, my probleme is that when the user change of facebook account, it use the old userID…