Skip to content
Access Token module for AngularJs.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
accessToken.js
bower.json

README.md

angular-access-token

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.

Installation

# Bower
bower install angular-access-token --save

# NPM
npm install angular-access-token --save

Usage

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');
});
You can’t perform that action at this time.