Menu
  • HOME
  • TAGS

UI Router and Satellizer force login

angularjs,authentication,angular-ui-router,satellizer

I found the answer in this Github Repo the idea is to have role based authentication as discussed in the Repo readme. so the code for forbidding the unauthorised access to /profile would be something like the following $stateProvider.state("profile", { url: "/profile", templateUrl: "app/profile/profile.html", controller: "ProfileCtrl", controllerAs: "user", data: {...

Protractor testing, access and modify Window object properties

javascript,angularjs,protractor,jwt,satellizer

Working solution: browser.executeScript(function () { window.localStorage.satellizer_token = "eyJ0eXAiOiJKV1QiLCJhbGasdsOiJIUzI1NiJ9.eyJpZCI6IjE3MjUzIiwiaWF0IjoxNDM0Mzc1NjU3LCJleHAiOjE0NjU5Mjk2NTd9.VbhdWQ_gOb7X8pmOGLDjBKURQUQlcAfGSGvLRansQCphk"; }); ...

“Get Authenticated” loops forver on initial startup

javascript,angularjs,node.js,authentication,satellizer

Okay, I changed the controllers in the API, and the app.js file in the frontend. So the problem was somewhere in one of those. I believe the real issue was in the backend logic though. I went for a major simplification... and it worked. Changed the register action to: register:...

Satellizer causes Angular to pre-flight ALL of my rest queries with an OPTIONS request

angularjs,preflight,satellizer

After looking through the code and studying Angualr's httpProvider I realized that Sateliizer is intercepting every single request using httpProvider's interceptors array and adding the following: var token = localStorage.getItem(tokenName); if (token && config.httpInterceptor) { token = config.authHeader === 'Authorization' ? 'Bearer ' + token : token; httpConfig.headers[config.authHeader] = token;...

How to change Satellizer's $authProvider.loginUrl inside an Angular controller?

javascript,angularjs,satellizer

Usually provider objects can only be accessed at config time, whereas controllers are created in runtime. If you need to setup the authProvider, try doing: angular.module('PrayerChain').config( [ "$authProvider", function($authProvider) { $authProvider.loginRedirect = '/settings'; } ]).controller("loginCtrl", // ... ...

How to make satellizer use absolute url's?

angularjs,controller,forms-authentication,oauth-provider,satellizer

Set in your config: $authProvider.baseUrl = null; ...