0

I'm building an app using the new Parse PHP SDK. How can in include the user session token inside a ParseQuery?

1 Answer 1

3

If you set the ParseSessionStorage in your code, you can make use of the getCurrentUser() method in the SDK.

session_start();

// Init parse: app_id, rest_key, master_key
ParseClient::initialize('xxx', 'yyy', 'zzz');

$storage = new ParseSessionStorage();
ParseClient::setStorage( $storage );

$user = ParseUser::getCurrentUser();

You can then get the session token as follows:

$sessionToken = ParseUser::getCurrentUser()->getSessionToken();

You don't need to pass the session into calls. It will automatically use the session if available.

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

8 Comments

any simpler way to achieve the same? saw your blogpost for beginners to php+parse as well. Trust me I'm complete beginner
This is by far the simplest method to achieve this.
yes, did my own bit of trial and errors, and achieved it. Thanks a lot!
@Cristiana214 the library you are using it's the same as the Official Parse PHP SDK. You should update your code to use the Official Parse PHP SDK to make use of the new functions. The library you're using hasn't been updated in over a year.
@NirajShah how to use the Official Parse PHP SDK with codeigniter framework? that is why i chose the library because it fits to codeigniter.
|

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.