Login page

273 views
Skip to first unread message

John Brosan

unread,
Jan 6, 2016, 11:52:54 AM1/6/16
to Polymer
Hello everyone,

I am new to Polymer and have been trying to get up to speed. I am currently developing an API using the Loopback (Node.js/Express) framework along with MongoDB and want to use Polymer 1.x as the frontend. I have security setup on the Loopback application and it works as expected.  I am using the Polymer Starter Kit and would like to know how to add a login page to the app. How and where should I check to see if a user is logged in and redirect accordingly. I've been looking around and everything I see uses Firebase, which is great, but its not something I am using right now.

Any advice or help would be most appreciated.

Thanks,
John

tau...@whydonate.nl

unread,
Jan 19, 2016, 11:43:45 PM1/19/16
to Polymer
Hello John,

What I do to create Login module with Polymer:
- Create login module to put username & password and send them to the API via iron-ajax to get a token
- And then save the token with iron-localstorage
- If the token is already in iron-localstorage, you can control the logic of user logged
- Just that. This is right logic or bad for security reason? I still find it, maybe anyone here can give a opinion about this?  

I hope can a bit help.
Taufik

John Brosan

unread,
Jan 21, 2016, 3:12:18 PM1/21/16
to Polymer, tau...@whydonate.nl
Hi Taufik,

Thank you for the response. I wound up doing something very similar. Though I admit, it may not be best practice, so I am open to suggestions.

What I did was to create a login module with Polymer, and used iron-ajax as you stated. I was not fully aware of iron-localstorage so I wound up adding a user object to app.js in the Polymer Starter Kit. Though it sounds like I will want to investigate iron-local-storage a bit more as it sounds like a better solution.

Thanks,
John

micha...@gmail.com

unread,
Feb 16, 2016, 3:30:57 AM2/16/16
to Polymer
Hi,
why don't u use passport for the local provider. U can create a polymer login component to handle the login. There is a good example of the usage of passport on the loopback side. The example is easily extensible for social providers as well.....

Best, MIchael
Reply all
Reply to author
Forward
0 new messages