UNPKG

baasic-sdk-angularjs

Version:

AngularJS SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).

154 lines (99 loc) 3.68 kB
# baasicLoginService Baasic Register Service provides an easy way to consume Baasic Application Registration REST API end-points. * * * ### baasicLoginService.login() Returns a promise that is resolved once the login action has been performed. This action logs user into the application and success response returns the token resource. **Example**: ```js baasicLoginService.login({ username : '<username>', password : '<password>', options : ['session', 'sliding'] }) .success(function (data) { // perform success actions here }) .error(function (data, status) { // perform error handling here }) .finally (function () {}); ``` ### baasicLoginService.loadUserData() Returns a promise that is resolved once the loadUserData action has been performed. This action retrieves the account information of the currently logged in user. Retrieved account information will contain permission collection which identifies access policies assigned to the user and application sections. **Example**: ```js baasicLoginService.loadUserData() .success(function (data) { // perform success actions here }) .error(function (data) { // perform error handling here }) .finally (function () {}); ``` ### baasicLoginService.logout() Returns a promise that is resolved once the logout action has been performed. This action invalidates user token logging the user out of the system. **Example**: ```js var token = baasicAuthorizationService.getAccessToken(); baasicLoginService.logout(token.access_token, token.token_type) .error(function (data) { // perform error handling here }) .finally (function () {}); ``` ### baasicLoginService.routeService() Provides direct access to route definition. **Example**: ```js baasicLoginService.routeService.get('<id>', expandObject); ``` ### baasicLoginService.social.get() Returns a promise that is resolved once the get action has been performed. Success response returns a resolved social login provider Url. **Example**: ```js baasicLoginService.social.get('<provider>', '<returnUrl>') .success(function (collection) { // perform success action here }) .error(function (response, status, headers, config) { // perform error handling here }); ``` ### baasicLoginService.social.post() Returns a promise that is resolved once the post action has been performed. This action logs user into the application and success response returns the token resource. **Example**: ```js var postData = { email : '<email>', code:'<code>', activationUrl : '<activationUrl>', oAuthToken : '<oAuthToken>', oAuthVerifier : '<oAuthVerifier>', password : '<password>', returnUrl : '<returnUrl>' }; baasicLoginService.social.post('<provider>', postData) .success(function (collection) { // perform success action here }) .error(function (response, status, headers, config) { // perform error handling here }); ``` ### baasicLoginService.social.parseResponse() Parses social provider response parameters. **Example**: ```js baasicLoginService.social.parseResponse('<provider>'); ``` ### baasicLoginService.social.routeService() Provides direct access to route definition. **Example**: ```js baasicLoginService.social.routeService.get('<id>', expandObject); ``` * * * **Notes:** - Refer to the [Baasic REST API](http://dev.baasic.com/api/reference/home) for detailed information about available Baasic REST API end-points. - All end-point objects are transformed by the associated route service.