angularJS login connect to API backend -
i've found alot of text explaining haven't quite found i'm looking for. i'm hoping can point me in right direction. building angular app communicates ror back-end. on back-end there basic authentication username , password. moment i've hardcoded username , password app.js. i'm using restangular set so:
var authenticationtoken = btoa('username,password'); .config(function (restangularprovider) { restangularprovider.setdefaultheaders({authorization: 'basic ' + authenticationtoken}); }
but users have login when open app username , password. app can use send requests backend. have no real idea how set properly.
update figured out problem. i'm using default headers, while should using individual headers. can set in service call.
all need create text input in angular. follow example in angular documentation. in controller/directive (whatever scope store username , password) make authentication call did in question.
Comments
Post a Comment