Advertisement
Guest User

Untitled

a guest
Mar 8th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. var username='email loggin';
  2. var password='password of pcloud;
  3.  
  4. function make_base_auth(user, password) {
  5. var tok = user + ':' + password;
  6. var hash = btoa(tok);
  7. return "Basic " + hash;
  8. }
  9. $.ajax
  10. ({
  11. type: "GET",
  12. url: "https://api.pcloud.com/userinfo",
  13. dataType: 'json',
  14. async: false,
  15. data: '{}',
  16. beforeSend: function (xhr){
  17. xhr.setRequestHeader('Authorization', make_base_auth(username, password));
  18. },
  19. success: function (){
  20. alert('Working Fine');
  21. }
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement