Search Posts

Category: authentication

Getting response code 401 causes skipping code blocks

I’m writing an ionic v1/express/mongo/node app. When checking if the user is authenticated i have the following piece of code: checkAuthentication: function(token) { console.log(token); return $http.get(“http://validUrl/test”, { headers: { ‘testingAuth’: token } }).then(function(result) { return; }); } and am calling it like this: checkAuthentication(token).then(function(response) { console.log(“testing response: ” + response); // if a valid token is already in storage = response contains “Success”(?), just $state.go to main page, else call the login() function if […]

error 401 authenticate user at login page angularjs

I am creating a simple login form with only ‘username’ and ‘password’ fields. I have this as my auth.js and it keeps showing authentication error. I am new in coding and have copied and pasted from a few of my previous projects to create my own. Please help me see where went wrong and teach me if i’m doing authenticated right. I am connected to MySQL and have one admin account there. All this time […]

Authenticate all Request to REST API with no username/password to get any token

I am selling products, API fetch product from node back-end and show on angular front-end, Back-end is centralized and angular front-end is on multiple domain, I need to authenticate all request made from my angular front-end to node back-end. Users d’t have account. I need to make sure no one else copy the product data via POSTMAN or other services. JWT is not working as request are exposed so token can be copied so authentication […]

Power BI angular1 authentication

I am trying to integrate Power BI into angular 1 application. From my research i came to know i have to follow following process Authenticate User and get access token By using this token get Embed token But i am struck at first step. How to authenticate? i have made an API call to with parameters : grant_type:’password’, client_id: clientId, resource:’‘, scope:’openid’, username:username, password:password, client_secret : client_secret i am getting following response : “error”: […]

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 […]