Skip to content

90TechSAS/zlAuth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

zlAuth

Usage

  • It is mandatory to set the root url and appId:

        myApp.config(['zlAuthProvider', function(zlAuthProvider){
            zlAuthProvider.setAppId(appId)
                .setRootUrl(authUrl)
        }]);

You can also set loginRoute (defaults to /user/login) and token refreshRoute (/user/refresh)

  • If a token is found in location.hash (the user has been redirected from login page) or in local storage, the module will use it.
  • Set zlAuth.getToken() as your token provider whenever you need id. This returns a promise that will be resolved immediately if the token is still valid, or after refreshing it. If there is no way to obtain a valid token, the module will redirect the user to loginRoute.