This is a somewhat broad question. I am building a stripe server with node and express and hitting it with a react frontend. I have put together the basic api where i can create customers, save payment methods and access accounts to edit, update etc.
Payment method details are collected via Stripe's own recommended react-stripe
package that protects PPI to keep things compliant with government regulations on privacy.
Now I am trying to secure the rest api so that only validated individuals can access the api endpoints. So for example I have a GET
endpoint that displays profile details for a customer and the endpoint looks something like: route/:customerId
. Presumably I could only access the route If I had a customerId
, but is there another layer I can add that secures the endpoint more?
I am trying to figure out the best way to do this and I have come across the following two options:
- JWT
- OAuth2
I ma unsure if perhaps I am misunderstanding usage here. Are one of these two the right approach to securing a rest api?