ionicUser.save() returns 401 after upgrade to 1.2.4


#1

Hi,
I’ve been using successfully the ionic platform:

    "ionic": "driftyco/ionic-bower#1.1.1",
    "ionic-platform-web-client": "~0.2.1",

and now I’m upgrading into the latest ionic 1.2.4:

    "ionic": "driftyco/ionic-bower#1.2.4",
    "ionic-platform-web-client": "~0.6.0",

according to the docs not much has changed in terms of using the Ionic.User api.

The thing is that the save method always returns a 401 error, code details:

	// this will give you a fresh user or the previously saved 'current user'
	var ioUser = Ionic.User.current();

	// if the user doesn't have an id, you'll need to give it one.
	if (!ioUser.id) {
		ioUser.id = Ionic.User.anonymousId();
	}

	//Add some custom info to user
	ioUser.set('username', _self.user.username);
	ioUser.set('platform', ionic.Platform.platform());
	ioUser.set('vPlatform', ionic.Platform.version());

	//persist the user
	ioUser.save().then(function (response) {
		console.log('Identified user ' + JSON.stringify(ioUser));
	}, function (error) {
		console.log('NOT Identified user ' + JSON.stringify(ioUser));
	});

returns:

{
	"meta": {
		"version": "2.0.0-beta.0",
		"status": 401,
		"request_id": "55d2e1fb-b88b-4b31-bac2-c8a420217962"
	},
	"error": {
		"type": "Unauthorized",
		"message": "Authorization header is missing.",
		"link": null
	}
}

The error is quite explanatory, it looks like the call does not have the requested headers or something like that.

What should I do??
Is this platform version only allowed for ionic 2? (the meta.version attribute might point there)


#2

All right,
just if anyone else gets here I was mixing code from platform 1.0 while installing platform 2.0-beta.

The docs are a little bit confusing about versions and compatibiliy but I guess that it is a work in progress. Now there is a page that takes care of this details: http://docs.ionic.io/docs/migration-guide.