Skip to content

Commit

Permalink
Pajax 0.5 overhaul
Browse files Browse the repository at this point in the history
- Upgrade to pajax 0.5
- Replace scheduling with validateToken() method
- replace configure() with initialize()
- addBearerToken validates the token()
  • Loading branch information
Dani723 committed May 16, 2016
1 parent 689cdd4 commit 1416838
Show file tree
Hide file tree
Showing 3 changed files with 177 additions and 245 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

OAuth 2 bearer token manager and client, supporting refresh tokens.

This library is targeted for the browser as it makes use of
This library is targeted for the browser as it makes use of
the the local storage API.

### Installation
Expand All @@ -17,7 +17,7 @@ import TokenAuthN from 'token-authn';
var authN = new TokenAuthN(oAuthURL);
authN.useLocalToken().then(...);
authN.validateToken().then(...); // Validates the session token
authN.login(username, password, rememberMe).then(...);
authN.logout().then(...);
Expand All @@ -32,8 +32,12 @@ authN.tokenInfo; // Contains access and refresh token

All API operations are promise based.

On `useLocalToken()`:
- See if persisted token info exists in local storage and read token info
In Constructor
- See if persisted token info exists in local storage and read token info
- See if the 'access_token' is not expired yet
- If it is not expired, set state to loggedIn

On `validateToken()`:
- See if the 'access_token' is not expired yet
- If it is, see if a refresh token exists an use it to get a new access token
- If it fails, the promise rejects
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "token-authn",
"version": "0.3.1",
"version": "0.4.0",
"keywords": [
"token",
"authentication"
Expand All @@ -12,9 +12,7 @@
"url": "www.n-fuse.de"
},
"contributors": [],
"license": {
"type": "MIT"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/n-fuse/token-authn"
Expand All @@ -23,9 +21,9 @@
"registry": "jspm",
"dependencies": {
"log": "github:n-fuse/holzfella@^0.1.0",
"pajax": "github:n-fuse/pajax@^0.4.0",
"pajax": "github:n-fuse/pajax@^0.5.0",
"pajax-uri": "github:pajax/pajax-uri@^0.1.0",
"moment": "^2.9.0",
"lodash": "^3.2.0",
"state-machine": "github:jakesgordon/javascript-state-machine@^2.3.5",
"store": "npm:store@^1.3.17"
},
Expand Down
Loading

0 comments on commit 1416838

Please sign in to comment.