fnakstad / angular-client-side-auth

One way to implement authentication/authorization in Angular applications
http://angular-client-side-auth.herokuapp.com/
MIT License
1.63k stars 346 forks source link

Server depends on a file located in the client directory #102

Closed declanelcocks closed 8 years ago

declanelcocks commented 8 years ago

Hey, a bit late to the party, but I've been going through your app updating it to the latest version of Angular and updating it to a more Angular 2 friendly syntax (no $scope, using modules instead of controllers.js etc.) and I came across this issue.

The issue is that both the server and the client are using the routingConfig.js file. This is not a big problem, but when you start to think about minification and deploying the app then it becomes a problem. Ideally, you would want the client and server to be completely independent, so that you can host the server in one location and have several clients deployed that can all access the server and its API.

One instant solution could be to just host routingConfig on both the client and server, but of course that is not efficient at all. What do you think would be a good solution for this? The fact that both the client and server depend on this file doesn't seem like good logic.

Naeemo commented 8 years ago

I think this configure file should be with the server only. The browser will have to get it from the server rather than the client:

1.the server should be the only one who can change the authority configurations. 2.when this file changed(the authority configurations changed), it will immediately be effective.