Cyprian
Cyprian

Reputation: 9453

How to save data to user session in Parse.com

After I log in the user on the backend (I use Parse.com CloudCode) I would like to save the uri to his avatar in his session. How would I do it in Parse.com. I know there is an object Parse.Session.current() but not sure how to use it.

Upvotes: 0

Views: 437

Answers (1)

danh
danh

Reputation: 62676

Treat it just like other objects provided by parse.

Parse.Session.current().then(function(session) {
    session.set("foo", "bar");
    session.save().then(function() {
        console.log(session.get("foo"));
    });
});

The session CLP should be set to allow this. (And the app must be setup to require revokable sessions).

Upvotes: 1

Related Questions