I have a simple application. I need to implement some Api's with security (to be used it in back office) and some without it (to be used in the website).
I wasn't working on the issue for some days so sorry if I'm late.
I have tried UmbracoAuthorizedApiController as you've suggested but it keep giving me "401 Unauthorized" now.
What could be wrong?
The only thing that I could think of was Cookies, so I've checked that. There is a Cookie attribute with UMB-XSRF-TOKEN and UMB-XSRF-V, etc in my request headers.
P.S: I've changed my routing using attributes and it was working fine.
I still don't think that the problem is related to that, since it is not returning 404, but in case there is a relation:
[RoutePrefix("api/admins")]
public class AdminsController : UmbracoAuthorizedApiController
Some Api's with security and some without it
I have a simple application. I need to implement some Api's with security (to be used it in back office) and some without it (to be used in the website).
I've read the Article in the documentation: https://our.umbraco.org/documentation/Implementation/Rest-Api/
But how can I enable it only for 1 controller and not for the other?
Hi Ashkan
Try to use "Umbraco.Web.WebApi.UmbracoAuthorizedApiController", I think it's what you need, read more:
https://our.umbraco.org/documentation/Implementation/Controllers/
Thanks Alex for reply,
I wasn't working on the issue for some days so sorry if I'm late.
I have tried UmbracoAuthorizedApiController as you've suggested but it keep giving me "401 Unauthorized" now.
What could be wrong?
The only thing that I could think of was Cookies, so I've checked that. There is a Cookie attribute with UMB-XSRF-TOKEN and UMB-XSRF-V, etc in my request headers.
P.S: I've changed my routing using attributes and it was working fine. I still don't think that the problem is related to that, since it is not returning 404, but in case there is a relation:
is working on a reply...