1

I am going to implement angular SPA application which will use mvc webApi methods with authorize attribute, so I need to add authentication mechanizm, and here is my question 1. Better move standard accountController with views or 2. Add mvc webApi accountController and implement views and request myself using angular ?

AFIK in case of using webApi authentication I will have to get token and add this token with each request so a lot of manuall work.

How about mixing standard accountController and webApi methods ? Do I have to maintain tokens here manually as well ?

1 Answer 1

2

My recommendation is to seperate the API from the front-end application, do not mix this in one project; because eventually you will not be able to scale your app especially if you decided to build another front-end application consuming the same back-end API.

As well sending the token manually in Authz header gives you flexibility and you know what is going behind the scenes.

Check my AngularJS authentication series if you didn't check them already where I guide the reader to implement AngularJS authentication in a neat way.

Sign up to request clarification or add additional context in comments.

4 Comments

seperate api you mean ? by giving an example, all the login stuff put into UI mvc application and create another project with rest of my api ?
Yes, project for Web API which contains the authentication stuff and generating token, no UI at all. And another one (empty project) which contains all your UI, partial views, and AngularJS stuff.
I don't get it, You want to put accountController, tokenProvider class and chalangeResult (which is authentication stuff) into onther classLibrary project, angular into MVC UI and orders api also into mvc UI ? Please explain me that.
Please check the posts again, download the repo, it contains everything you need to do. it is exactly the same as your case.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.