{"library":"sanji-auth-ui","title":"Sanji Auth UI","description":"Sanji Auth UI is a core component of the Sanji UI framework, specifically designed for seamless integration within AngularJS 1.x applications. It provides robust authentication and authorization services, leveraging JSON Web Tokens (JWT) for secure user identification and session management. The package includes an `auth` service for handling login requests and a `session` service for storing and retrieving authenticated user data. Its current stable version is `1.4.0`, released in September 2018, indicating an infrequent and likely discontinued release cadence. A key differentiator is its tight coupling with the AngularJS 1.x ecosystem (specifically versions 1.5.0 to 1.6.x), making it unsuitable for modern Angular or other contemporary frontend frameworks. It also relies on specific versions of `angular-http-auth`, `angular-storage`, and `sanji-rest-ui` as peer dependencies.","language":"javascript","status":"abandoned","last_verified":"Wed Apr 22","install":{"commands":["npm install sanji-auth-ui"],"cli":null},"imports":["angular.module('myApp', ['sanji.auth'])","class MyController { constructor($http, auth, session) { /* ... */ } }","class MyController { constructor($http, auth, session) { /* ... */ } }"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"angular.module('webapp', ['sanji.auth'])\n  .controller('AppController', ['$http', 'auth', 'session', function($http, auth, session) {\n    this.credentials = { username: '', password: '' };\n    this.login = (credentials) => {\n      // Authenticate a user\n      auth.login('/auth/local', credentials)\n      .then((data) => {\n        // Return token data\n        return $http.get('/users/me');\n      })\n      .then((res) => {\n        // Return authenticated user data and save in session service\n        session.setUserData(res.data);\n        console.log('User logged in:', session.getUserData());\n      })\n      .catch((error) => {\n        console.error('Login failed:', error);\n      });\n    };\n  }]);\n\n// Example of configuring authProvider\nangular.module('webapp').config(['authProvider', function(authProvider) {\n  authProvider.configure({\n    roles: {\n      admin: 'admin',\n      guest: 'guest'\n    }\n  });\n}]);\n\n// Example of configuring sessionProvider\nangular.module('webapp').config(['sessionProvider', function(sessionProvider) {\n  sessionProvider.configure({\n    tokenHeader: 'Authorization',\n    tokenKey: 'jwt_token'\n  });\n}]);","lang":"javascript","description":"This quickstart demonstrates how to include the `sanji.auth` AngularJS module, inject the `auth` and `session` services into a controller, perform a user login with credential handling, and configure the `authProvider` and `sessionProvider`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}