How to organize simple authorization on AngularJs? I googled, but found nothing suitable. Share screencasts / articles. Thank.
1 answer
If you want to use basic auth , then for the beginning it will be more convenient for you to work with the library for encoding in base64. For example this .
After connecting this library, you will need to add http header to the config
angular .module('myApp', ['base64']) .config(function($httpProvider, $base64) { var auth = $base64.encode("foo:bar"); $httpProvider.defaults.headers.common['Authorization'] = 'Basic ' + auth; })
You can read more in the article .
|
angular
authorization? - Stepan Kasyanenko