angularjs - Angular 1.6 sends OPTIONS instead of POST -
i'm trying basic authentication rest api using angularjs in console i'm getting possibly unhandled rejection. , on server
"options /api/users http/1.1" 301 0
app.factory('api', ['$resource', '$base64', function ($resource, $base64) { function add_auth_header(data) { return 'basic ' + $base64.encode(data.username + ':' + data.password); } return { auth: $resource('127.0.0.1:8000/api/users/', {}, { login: {method: 'post', headers: { 'authorization': add_auth_header }}, logout: {method: 'delete'}, }) }; }])
Comments
Post a Comment