Welcome Guest, Not a member yet? Register   Sign In
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




Theme © iAndrew 2016 - Forum software by © MyBB