0

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.

1 Answer 1

1

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).

Sign up to request clarification or add additional context in comments.

2 Comments

when I try this I get an error the session object does not have a method set. and when I do JSON.stringify(session) I get the following JSON {"_resolved":false,"_rejected":false,"_resolvedCallbacks":[],"_rejectedCallbacks":[]}
Sorry, my bad. It needs to be fetched asynchronously. Please see edit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.