Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 893 Bytes

File metadata and controls

18 lines (13 loc) · 893 Bytes

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.