Using a bearer token API back end with an MVC front end (separate apps)

Viewed 370

This question seems to have been asked a lot, but I am afraid I need more help.

I have a WebAPI application that uses bearer tokens. It works fine.

I want to build into my SEPARATE (not on same server) MVC application and use bearer token authentication.

I would like to use something baked into MVC and not roll my own.

I can easily within MVC make a call to the API, get a token, and then request a protected resource from the API adding the token to the auth header and it works fine.

What I need is how to manage login/logout, support of 'Authorize' attribute on controller actions, support of 'User.IsAuthenticated' in MVC, etc.

Is there some config in the MVC app itself that can streamline the use of bearer tokens (like a startup.auth config) and not have to come up with some klugey session object-based way of storing bearer tokens?

Thanks.

1 Answers
Related