Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //authorization grant type: Resource owner password-based.
- const HOST_ADRESS = "192.168.104.137:8000"; //change with your own host
- const client_id = "jpijpijpijpijipjipijipijipijipj";
- fetch('http://'+HOST_ADRESS+"/oauth/token/", {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Cache-Control': 'no-cache'
- },
- body: "client_id=sfjwepifjpfweijgpeijSGIOEJOPGIWSJA35340537530708&grant_type=password&username="+username+"&password="+password
- })
- .then((response) => response.text())
- .then((responseText) => {
- console.log(responseText);
- //redux succed do something.
- //dispatch(actionsCreators.succesLogin(responseText));
- })
- .catch((error) => {
- const data = {error: "A error happened"};
- //redux error.
- //dispatch(actionsCreators.errorLogin(data));
- console.warn(error);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement