0

I am trying to make a something like a shopping cart. I want to add a feature, that if a person adds a product on website but does not purchase the item, i will send him an email with a link. If the person clicks on the link, then I want to login him automatically and take him directly to payment page. I don't want him to enter password in between. So can I somehow create some API call which can login him and then redirect him to concerned URL?

  • This would totally depend on the tools you use. Basically: Yes, you could use something like a unique generated ID that is part of the link and your authorization system should be able to accept this (once) instead of the full login. (There are various security implications to take care of). That said: The moment you send me unrequested emails your service would be blacklisted by me and I would never purchase from you again (most likely anyway, this may depend on what exactly you sell). So maybe think twice if this is something your customers want or would find annoying. – thorsten müller Jun 10 '15 at 11:20
  • Do I need to take care of the threats from email service provider i.e. email provider will definitely have the access to that link? – Shashwat Kumar Jun 10 '15 at 11:43
  • 1
    yes, that would be one of the main problems here. Not only the email provider but also inside the company the IT department and potentially many other people may have access to emails. I have rarely or actually never seen pages doing autologin features like this. I order a lot of stuff online and if they sent you a link for whatever reason it will always require login (unless you are already logged in and the site remembers logins which is much more common). Also allowing to login with facebook, google etc makes login easy and fast. – thorsten müller Jun 10 '15 at 12:00
2

Sure you can. It's your application, you can handle access to it the way you want. But you should remember several important points.

  • Whoever gets access to that link gains access to the customer's payment page. That is a lot of access to be sent over something as blatantly insecure as email.

  • The link that you generate should not transparently include any user credentials. This is easy to get horribly wrong. You don't want to create something that allows an attacker to access every other customer's payment data just by incrementing a number somewhere in the URL.

  • The link should probably be usable only once, and only within a short time of its generation, to mitigate the risks that you can't avoid when generating such pre-approvied log-ins.

  • Do I need to take care of the threats from email service provider i.e. email provider will definitely have the access to that link? – Shashwat Kumar Jun 10 '15 at 11:29
  • @ShashwatKumar The biggest problem with email is that they're not encrypted in transit. Any server through which that email is routed can make a copy. It's occasionally interesting to look at the Received: header of the email you receive to get a feeling for the problem, but note that copies can be made without leaving such a trace – which e.g. certain advanced persistent threats routinely do. Using “nonces” for login would make misuse somewhat detectable, and limited-time tokens shorten the window of opportunity for misuse – good enough when your users aren't actively targeted. – amon Jun 10 '15 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.