Advertisement
Guest User

Untitled

a guest
May 20th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. //authorization grant type: Resource owner password-based.
  2. const HOST_ADRESS = "192.168.104.137:8000"; //change with your own host
  3. const client_id = "jpijpijpijpijipjipijipijipijipj";
  4. fetch('http://'+HOST_ADRESS+"/oauth/token/", {
  5. method: 'POST',
  6. headers: {
  7. 'Content-Type': 'application/x-www-form-urlencoded',
  8. 'Cache-Control': 'no-cache'
  9. },
  10. body: "client_id=sfjwepifjpfweijgpeijSGIOEJOPGIWSJA35340537530708&grant_type=password&username="+username+"&password="+password
  11. })
  12. .then((response) => response.text())
  13. .then((responseText) => {
  14. console.log(responseText);
  15. //redux succed do something.
  16. //dispatch(actionsCreators.succesLogin(responseText));
  17. })
  18. .catch((error) => {
  19. const data = {error: "A error happened"};
  20. //redux error.
  21. //dispatch(actionsCreators.errorLogin(data));
  22. console.warn(error);
  23. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement