$tokenProvider()
Provider for ngToken. Sets configuration options and exposes the $token service.
- Source:
Methods
-
keepAlive(url)
-
Sets the endpoint to call to keep a token alive
Parameters:
Name Type Description url
String URL to set as the endpoint
- Source:
Example
angular.module('someModule', ['ngToken']) .config(function($tokenProvider){ $tokenProvider.keepAlive('/api/keepAlive'); });
-
logout(url)
-
Sets the endpoint to call to log a user out
Parameters:
Name Type Description url
String URL to set as the endpoint
- Source:
Example
angular.module('someModule', ['ngToken']) .config(function($tokenProvider){ $tokenProvider.logout('/api/logout'); });
-
newToken(url)
-
Sets the endpoint for a new token
Parameters:
Name Type Description url
String URL to set as the endpoint
- Source:
Example
angular.module('someModule', ['ngToken']) .config(function($tokenProvider){ $tokenProvider.newToken('/api/token'); });
-
tokenStorage(storage)
-
Sets the storage type.
Parameters:
Name Type Description storage
String Type of storage. Can be localStorage or sessionStorage
- Source:
Example
angular.module('someModule', ['ngToken']) .config(function($tokenProvider){ $tokenProvider.tokenStorage('sessionStorage'); });