Best way to protect a REST Api without requiring user authentication

Jordan

Is this even possible.

The given scenario is I am building a store either with ember.js or backbone.js. The store will be able to get all the products and individual products as it should. However when the user wants to buy an item they are taken directly to checkout and there is no cart or user signup/login process. I am wondering if it's possible to somehow authenticate the new POST request that comes in to update the quantity and post back the users shipping info based not on if the user is logged in and has authenticated but maybe based on where the request is being made from? For instance based on IP or based on the signature of the SSL certificate present on the client side.

I've been using Parse to play with a backend and using ember for the front end to this point, ember data offers great resources to interface with REST apis but most require that the key be passed to the request somehow and thus placed right inside the client side code. Not good. How can I achieve this with my given scenario or is it simply not possible?

Joachim H. Skeie

I am not sure how you will be able to distinguish which of your users ordered what, without somehow having them authenticate themselves.

Online stores generally perform this in one of two ways:

  1. Have the user sign up, and log in. This way the user is authenticated and validated
  2. Have the user supply shipping information on the page when the user makes a purchase

With option 1, its somewhat obvious how you can know which user orders what, because you have validated the user in your Ember.js app and on your server-side.

With option 2, you still have to create an in-browser cookie or otherwise store an identifier that you can send to your server along with the user data. That way, when the user comes back from making their purchase, you can still identify what the user have purchased, and act accordingly in your app.

So you process will be something like:

  1. Create and assign a cookie to your user when they enter your site
  2. When the user makes a purchase, you will ask the user for some extra information (shipping info, name, etc). Send this to the server, which will then also receive the cookie-information.
  3. When the user comes back from their purchase (I am assuming you are using a third party payment processor here, which will call back with a URL on your server), your server side will know the status of the purchase (approved, rejected, etc), and based on the cookie the user had at the time of purchase, you can show the user the status of their purchase.

The downsides of this is that if the user uses another device, browser or deletes their cookies, that you won't be able to display the user with their previous purchase information.

I hope that answers your questions.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Best way to secure Private REST API without user authentication for mobile app

From Dev

WP REST API - User registration without authentication

From Dev

Java rest API authentication, best practises with JWT

From Java

Rails API : Best way to implement authentication?

From Dev

REST API Authentication both User and Applicatoin

From Dev

User registration/authentication flow on a REST API

From Dev

User authentication methods for REST api project

From Dev

User authentication methods for REST api project

From Dev

Rest API: client authorization and end user authentication

From Dev

.NET gmail API Authentication (without user interaction)

From Dev

Google Drive API authentication without user interaction

From Dev

What is the best way to user authentication with Devise 3 and Backbone?

From Dev

What is the best way to user authentication with Devise 3 and Backbone?

From Dev

As a Kubernetes admin, what is the best way to handle user authentication for kubectl?

From Dev

Rails REST API Server: protect_from_forgery option and where to put authentication token

From Dev

User authentication best practices

From Dev

Automating Matlab without requiring the user to be logged in

From Dev

JHipster Create user without requiring activation

From Dev

JHipster Create user without requiring activation

From Dev

Is there a way to communicate with a minifilter without requiring admin rights?

From Dev

Is there a way to communicate with a minifilter without requiring admin rights?

From Dev

Is there a way to build Intu without requiring qibuild?

From Dev

Secure REST API without user authentification (no credentials)

From Dev

What is the best way to protect a flask endpoint?

From Dev

Best way to protect against SQL injection in SqlDataAdapter

From Dev

Best way to password protect a dropbox file

From Dev

Using a REST API that interfaces with AWS RDS (psql) - how do I protect the db access (writes) beyond API authentication?

From Dev

How to use Firebase REST API(Python) for authentication of a user?

From Dev

Yii2 Rest Api User bearer Authentication expiration time

Related Related

  1. 1

    Best way to secure Private REST API without user authentication for mobile app

  2. 2

    WP REST API - User registration without authentication

  3. 3

    Java rest API authentication, best practises with JWT

  4. 4

    Rails API : Best way to implement authentication?

  5. 5

    REST API Authentication both User and Applicatoin

  6. 6

    User registration/authentication flow on a REST API

  7. 7

    User authentication methods for REST api project

  8. 8

    User authentication methods for REST api project

  9. 9

    Rest API: client authorization and end user authentication

  10. 10

    .NET gmail API Authentication (without user interaction)

  11. 11

    Google Drive API authentication without user interaction

  12. 12

    What is the best way to user authentication with Devise 3 and Backbone?

  13. 13

    What is the best way to user authentication with Devise 3 and Backbone?

  14. 14

    As a Kubernetes admin, what is the best way to handle user authentication for kubectl?

  15. 15

    Rails REST API Server: protect_from_forgery option and where to put authentication token

  16. 16

    User authentication best practices

  17. 17

    Automating Matlab without requiring the user to be logged in

  18. 18

    JHipster Create user without requiring activation

  19. 19

    JHipster Create user without requiring activation

  20. 20

    Is there a way to communicate with a minifilter without requiring admin rights?

  21. 21

    Is there a way to communicate with a minifilter without requiring admin rights?

  22. 22

    Is there a way to build Intu without requiring qibuild?

  23. 23

    Secure REST API without user authentification (no credentials)

  24. 24

    What is the best way to protect a flask endpoint?

  25. 25

    Best way to protect against SQL injection in SqlDataAdapter

  26. 26

    Best way to password protect a dropbox file

  27. 27

    Using a REST API that interfaces with AWS RDS (psql) - how do I protect the db access (writes) beyond API authentication?

  28. 28

    How to use Firebase REST API(Python) for authentication of a user?

  29. 29

    Yii2 Rest Api User bearer Authentication expiration time

HotTag

Archive