How to build a middleware with Parse SDK

21 views
Skip to first unread message

f.re...@googlemail.com

unread,
Jan 26, 2019, 12:38:42 PM1/26/19
to Back4App
Hi,
I'm having trouble to undersstand how I would build a middleware with the parse Javascript sdk to protect certain sites.
When logging a user in a token is set in local Storage. But how can I access it and when do I know that it needs to be destroyed?
Of course I could set a variable isAuthenticated when successfiully logging in but I don't think that is the way it should work/is secure.


nat...@back4app.com

unread,
Feb 5, 2019, 11:56:24 AM2/5/19
to Back4App
Hi,

thanks for reaching you! You can use Parse SDK into your JavaScript project, you can use the cached method Parse.User combined with an authentication method with localStorage or any other storage you configured. Check the links below to help you:

Signing Up => https://docs.parseplatform.org/js/guide/#signing-up



You can clear the current user by logging them out:

Parse.User.logOut().then(() => {
 
var currentUser = Parse.User.current();  // this will now be null
});


If you need any other help, let us know :)

Regards,
Natália.
Reply all
Reply to author
Forward
0 new messages