• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how implement library rest with authentication

#1
Hi,
how i implement authentication with rest (REST_CONTROLLER LIBRARY) and jquery but in global way and not for each petition

jquery
PHP Code:
$config['rest_valid_logins'] = array("admin"=>"1234");$.ajaxSetup({
    xhrFields: {
        withCredentialstrue
    
},
    beforeSend: function (xhr) {
        xhr.setRequestHeader('Authorization''Basic ' btoa('admin:1234'));
    }
}); 

rest
PHP Code:
$config['auth_source'] = 'basic';
$config['rest_valid_logins'] = array("admin"=>"1234"); 


regards
Reply

#2
Storing plain passwords in javascript file is big no-no and unacceptable.
What ever is up to passwords it mustn't be tied with javascript.
Considering CI and REST, have you checked this tutorial?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.