Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong sessionToken on users query #1347

Closed
nirco123 opened this issue Apr 3, 2016 · 2 comments
Closed

Wrong sessionToken on users query #1347

nirco123 opened this issue Apr 3, 2016 · 2 comments

Comments

@nirco123
Copy link

nirco123 commented Apr 3, 2016

If I query specific user using masterKey, user.getSessionToken() return some random string that is not the user session token

Setup to produce

var query = new Parse.Query(Parse.User);
query.equalTo("username", username);
query.find({
    useMasterKey: true,
    success: function(users) {
        // Do stuff
        console.log(users);
        if (users == undefined || users.length == 0)
        {


        }
        else
        {
       **  // The following session token is not the right one.
          users[0].getSessionToken()**

        }
    },
    error: function() {
        response.error("Not authorized");
    },
});
@flovilmart
Copy link
Contributor

Can you try do

Parse.User.become(users[0].getSessionToken()).then(function(user) { 
console.log(user.get('username')) 
});

@gfosco
Copy link
Contributor

gfosco commented Apr 4, 2016

Users do not contain a session token, the session token is part of a _Session object. If you log in a user, through any means, you'll get a session token back as part of the user, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants