9

I have created a WebApi 2.2 project (from an Empty New ASP.NET Project) to prove some implementation concepts and I now want to add Authentication to it.

I notice that the only way to add Authentication on a new WebApi app is to use one of the (VS 2013, in my case) Templates.

Is there a sure-fire way of adding Authentication to an already existing WebApi 2.2 app?

I will only want to use bearer tokens, if that makes a difference to any answers I may receive.

1
  • There are several ways to add Authentication to an existing project. For example, you could use filters, possibly combined with attributes, either built-in ones or custom ones. You can also use a DelegatingHandler, although that is probably not a good idea. Commented Oct 3, 2014 at 12:53

1 Answer 1

14

Yes you can add the bearer authentication from scratch, I'm not big fan of the VS 2013 templates because they mix between cookies and tokens authentication. You can check my detailed blog post on how to add bearer tokens only to new or existing Web API project. Let me know if you need further help.

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

2 Comments

That's a great post, but for the sake of posterity, could you add a quick summary to your answer? meta.stackexchange.com/a/8259
Indeed - what if you aren't using Angular, just regular Javascript?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.