Access Token module for AngularJs. You can use this module if use the approach of access tokens to store security credentials for a login session which identifies the user.This module is very useful if you consume password
or user credentials
grant of oauth2 for user authentication.
# Bower
bower install angular-access-token --save
# NPM
npm install angular-access-token --save
var app = angular.module('MyApp', ['htAccessToken']);
app.controller('LoginCtrl', ['htAccessTokenManager', function(accessTokenManager) {
// store access token in local storage with expiry of 3600 seconds
accessTokenManager.setToken('sadfsadf', 3600);
console.log(accessTokenManager.hasToken()); // true
console.log(accessTokenManager.getToken()); // sadfsadf
}]);
// for using token interceptor to automatically send token as Authorization header
app.config(function ($httpProvider) {
$httpProvider.interceptors.push('htAccessToken.interceptor');
});