Reputation: 85
I have a MVC4 application used to comunicate with an API,
this application get a Bearer Token from the API on the first login,
then the token must be sent to the api on each request.
Just to be clear, it's like this :
[MVC Website] <-> [API] <-> [SQL database]
Session with token would be on the MVC website, not the api...
As such, since the MVC4 application is the client of the API,
is it a good approach to store this Token in the Session of the MVC4 wesite?
No exchange is made with the API exept the request, so it's still stateless, or am i missing something?
Thanks for the help !
Upvotes: 1
Views: 569
Reputation: 44680
If you have reasons to store token in ASP.NET MVC client application session, you can do it. I would say, session (and maybe database) is the best place to store API auth token.
The only problem you have to handle is token expiration.
Upvotes: 1