reactjs - How to send POST login request to a rails api-only app using React? -
i have working rails restful api-only app.
use postman consume api. now, use api user have login http://localhost:3002/authenticate first setting content-type application-json in header email , password's value in body. after sending post request server auth-token json response. after successful login have pass auth-token authorization key in each get request respective data.
now, want build ui back-end api learn react js. till tutorials find how send requests without authorization factor. , using axios, redux etc.
- can any-one please guide me on should start or how approach problem?
- do have use third-party library purpose? if better axios or redux??
- any beginner friendly tutorial link of tremendous help
how start
securing react redux apps jwt tokens - rajaraodv explains how jwt token , how keep in front end app. think way fits you.
keep auth-token
rajaraodv uses localstorage keep jwt token, can use same or keep directly in redux store, it's choice, best manner fits you.
ajax call
you can use axios make ajax calls, or use fetchapi browser rajaraodv did, it's you.
explains
"if better axios or redux??" these 2 libraries totally different, each it's own purpose.
Comments
Post a Comment