playMaker

Author Topic: Parse Current User  (Read 5602 times)

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
Parse Current User
« on: May 12, 2014, 03:29:12 PM »
Hi,

is there a way to have to have the app login automatically if a user has been cached previously as documented here :

https://www.parse.com/docs/unity_guide#users-current

thanks
Yaniv
Visit my portfolio: http://www.yanivcahoua.com/

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Parse Current User
« Reply #1 on: May 13, 2014, 07:49:42 AM »
Hi,

 yep, when you pass "none" to parse actions it fall back on the current user already.

example: ParseObjectGetProperty, check the action description, it says: "Leave ObjectId to none to target the current user."


Bye,

 Jean

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
Re: Parse Current User
« Reply #2 on: May 13, 2014, 03:15:51 PM »
What I am trying to do is :

if the user has already logged in the past, his details should be cached on the hard disk, so when he opens the application again  he should be logged in automatically.

So you won't have to login each time you open the application.

I just tried  leaving the login email and password to none but it won't login using previously saved data. I am probably missing something.

could you explain me how to setup such a login
thanks
Yaniv
Visit my portfolio: http://www.yanivcahoua.com/

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Parse Current User
« Reply #3 on: May 14, 2014, 12:34:55 AM »
Hi,

 I think you should not login explictly again, and instead check if the current user is declared as you open the app.

 I haven't studied that behavior specifically. but I strongly doubt there is persistant data maintained by the parse sdk within Unity, have you studied the raw player prefs? if there is persistant data it will be in there for sure, this would be the first thing to check ( and ask on the Unity forum or Parse forum help section to know the exact behavior before getting lost with PlayMaker on this).

Bye,

 Jean

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
Re: Parse Current User
« Reply #4 on: May 16, 2014, 10:23:10 AM »
I got it working,
According to the parse documentation there is persistent data :

Quote
"Whenever you use any signup or login methods, the user is cached on disk. You can treat this cache as a session, and automatically assume the user is logged in:"

So I just use the GetUserProperty on the username of the current user and if doesn't exist it will redirect to the login state and if it already exist it will jump it.
We probably need a real "CheckIfCurrentUserExist" action though, for now it's ok as I plan to have a username for all my users, so I can work with the GetUserProperty.
Cheers.
Visit my portfolio: http://www.yanivcahoua.com/

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
Re: Parse Current User
« Reply #5 on: May 17, 2014, 09:21:46 AM »
@jean the Login action is a bit confusing when using a username to signup.
In this case you need to login with the username even if the variable says Email.

By the way, is there a way to see all the methods and variables that are in the Parse proxy ? I could play a bit with it and try to understand how things works behind the scene, it would help me a lot because your actions seems to not use the real Parse code and I can't understand them even with the Parse documentation.
Visit my portfolio: http://www.yanivcahoua.com/

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Parse Current User
« Reply #6 on: May 20, 2014, 10:00:03 AM »
Hi,

Yeah, I have some experience with Parse and unfortunalty, they enforce a unique username within the database, so this leads to a lot of not happy end users, because both have to be unique and that's completly unecessary. the email is the unique identifier.

 So, I strongly recommand registering user via email only, this is way more efficient, cause that's the only information you need to track a user, the username is junk in terms of meaning and only clutter the user interface and leads to people forgot their combination of usernames and emails... I have logs of users failing dozens of times because they have so many emails and so many variants of their username that they lost it completly...

 I'll add the username field, but be careful, this is a death trap.

The parse Proxy is only a set of helpers for me to provide easy actions setup. None of it belongs to the Parse API per say. That's why you are getting confused.

 The proxy is here to solve a major issue with parse... monthly payments :) you don't want that I know, and so I cache the object ID so that you don't have to get it over and over again during a session which is metered by parse to charge you, so the less requests you make to parse the cheaper for you.

that's all the proxy is doing. It's not related at all to parse api itself, I am only caching things up ( which is a shame cause they have a caching system on IOS and android, but they did not provided one for unity...  cause obviously, they loose money)

the parse documentation is all on their website,

https://parse.com/docs/unity_guide#unity_guide

Bye,

 Jean

 
« Last Edit: May 20, 2014, 01:43:21 PM by jeanfabre »

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
Re: Parse Current User
« Reply #7 on: May 21, 2014, 01:27:13 PM »
thanks,
I will probably follow your advice, unless at some point I decide to use the facebook login and log the user automatically to parse with their facebook credentials once they are logged in facebook.
Visit my portfolio: http://www.yanivcahoua.com/

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Parse Current User
« Reply #8 on: May 21, 2014, 03:51:30 PM »
Hi,

 For this particular case, I think it will need to anyway have a different system. I have planned to intergrate facebook and parse together, it's going to happen within the next few month on this project I am working with, and so I'll share this work then.

Bye,

 Jean

app_advisory

  • Junior Playmaker
  • **
  • Posts: 80
    • App Advisory
Re: Parse Current User
« Reply #9 on: October 02, 2014, 07:03:42 AM »
Hi,

Any news about this project (Parse + Facebook) ?

Thanks.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Parse Current User
« Reply #10 on: October 05, 2014, 06:39:50 AM »
Hi,

 Nothing planned for the next few weeks I am afraid, this particular project is still focused on other part of the application.

 Bye,

 Jean

app_advisory

  • Junior Playmaker
  • **
  • Posts: 80
    • App Advisory
Re: Parse Current User
« Reply #11 on: October 05, 2014, 07:33:39 AM »
Ok.

Thanks fo the reply !!