angular-access-token

Access Token module for AngularJs.

Added by: Sam Deering

GitHub

Repository

hrevert/angular-access-token

Stats

Stars: 1

Watchers: 1

Forks: 1

Module Description

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');
});

Module stats last updated: 2015-05-10 11:20:55

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!