asp.net mvc - Authorization token not present in header -
so, have custom authentication token utilize secure web.api project. bearer type token pass along header , have managed seamlessly consume within webapi project.
the complexity not beingness able utilize mvc project. [authorize]
tag on mvc uses system.web.mvc
library instead of system.web.http
. check happening header contains authorization token, used custom token attribute.
public override void onauthorization(authorizationcontext context)
in above function, when peek header using context.httpcontext.request.headers
, see there not authorization token in header. absurd utilize angular injectors add together bearer
token , much nowadays in client request beingness sent out.
what not doing receive token?
[update]
so after bit of debugging noticed authorize attribute not appended redirect url's. suppose because application doesn't have angular interceptors working these calls. thought how append authorize bearer token requests?
turns out cannot inject values header when there window.location.href
javascript not executed. it's direct post client browser. solution create cookie , consume on request.
asp.net-mvc angularjs asp.net-web-api owin authorize-attribute
No comments:
Post a Comment