asp.net mvc - Authorization token not present in header -


Therefore, I have a custom authentication token that I can use on my web I use the API to protect the project. Now it's a carrier type token that I pass with the header and I've been able to finally consume it within my webpia project.

The complexity is that I can not use it with my MVC project. MVC uses [Authorized] tag System.Web.Mvc library instead of System.Web.Http . I have used a custom token feature to see what is happening in my header, which contains the authorization token.

  Public Override Zero OnAuthorization (Authorized Insert Reference)  

In my top function, when I use context.HttpContext.Request Header in header, , I know that the title does not have authorization token. It's absurd because I use angular injectors to add a carrier token and client request is very much in there.

What am I not doing to get this token?

[Update]

Then after some debugging I saw that the authorized attribute has not been added to the redirected URL. I think this is because there are no angle interceptors in the application for these calls. How can I get any idea how to add all requests to Authorized Bearer tokens?

You can not inject the values ​​in the header when a window.location.href , because JavaScript is not executed. This is a direct post by the client browser, the solution is to create a cookie and use it on request.


Comments