Search Posts

Category: authentication

Django REST framework custom format for all out responses

In my project I use DRF as backend and Angular as frontend. Django==1.10 djangorestframework==3.7.1 I need all responses from DRF to be in the following format. { “status”: “”, // 200,400,…..etc “error”: “”, // True, False “data”: [], // data “message”: “” // Success messages } for this i have written a custom viewset and overridden the functions list, detail, create, update class ResponseModelViewSet(viewsets.ModelViewSet): def list(self, request, *args, **kwargs): queryset = self.filter_queryset(self.get_queryset()) page = self.paginate_queryset(queryset) […]

Methods of saving user info in AngularJS

I want to know about the ways of saving user info. Many seniors have recommended using $cookieStore, or Authentication or etc. But how about using $rootScope? My idea is when user has logged in, saving his/her id and password into $rootScope. (Naming like $rootScope.user_id = ‘stupid’;) Is this dangerous way? I don’t know whether this question is duplicated or not, but I couldn’t find one talking about using $rootScope. . . UPDATE My config is […]

How Authorization Token Works?

I am trying to understand how the Token system works between Web api and Angular JS for the authentication purpose. Please correct me if I am wrong. The token is stored in a database table and add the token manually on our client application to accompany every request we make from the client. Thanks. Source: AngularJS

Unable to inject one factory into another factory in angularjs 1 and send token to angularjs application

I have an application which is a php application. I want this application to reside in my primary domain ( purposely for Single-Sign-On(to manage account details). Every user login here and upon successful login, redirect to one of my app hosted on a Upon redirection, authorize the user by checking if the user really logged in. Now I have hosted an angularjs application in In my angularjs project, I have created a factory […]

Wait for authentication response from server before executing any Angularjs app

I have an AngularJS app (bootstrapped using ng-admin) contained within an admin backend where initial login to it is handled via LDAP. When the Angular app loads for the first time, it needs to make an API call (using Restangular) to the server to fetch a token plus derive a separate API url to use. Once the token is returned, it’s stored in localStorage and then passed to all subsequent API calls. Because I’m not […]

Firebase auth != null I can write but can’t read

I have been dealing with the authorization in Firebase for two days now and I can’t get it to work. Plenty of reading in the documentation and here in stackoverflow and still don’t get it. This is how my rules look like… { “rules”: { “.read”: false, “.write”: false, “notes”: { “.read”: “auth != null”, “.write”: “auth != null”, “.indexOn”: “uid” } } } My data looks like this… user-notes |_notes |_-ugly_id_for_this_record | |–date: “Sat […]