Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ayalatee 5 posts 75 karma points
    Jan 21, 2024 @ 05:15
    Ayalatee
    0

    UmbracoAuthorizedApiController return response 'enable script`

    I am using UmbracoApiController with authentication, so as written in the documentation I made my controller to inherit from UmbracoAuthorziedApiControlller. here is my code:

    public class CreationController : UmbracoAuthorizedApiController
    {
    
        [HttpGet]
        public IActionResult Check()
        {
           return Ok("check success");
        }
    }
    

    when I call the api from postman with this url: https://localhost:44354/Umbraco/backoffice/api/Creation/Check I get 200 response with the following text:

    For full functionality of Umbraco CMS it is necessary to enable JavaScript.

    my browser is enabling script, besides, I don't do this from browser but from postman. I tried to inherit from UmbracoApiController and add authroized attribute just like the samples in the documentation, and when I do that - I get 401 but I don't find a way to post my credetials in order the pass the authentication and get response.

    Can you help me please with those two cases? (or at least one of them)

  • Luuk Peters 85 posts 331 karma points
    Jan 23, 2024 @ 15:33
    Luuk Peters
    0

    The text 'For full functionality of Umbraco CMS it is necessary to enable JavaScript.' is the text from the login screen of Umbraco when it's loaded without Javascript. So I guess the response is the actual login screen of Umbraco in that case.

    The UmbracoAuthorizedApiControllers are meant to be used by backoffice users in Umbraco. I use them mainly for endpoints that work with Umbraco backoffice plugins. I'm not sure how easy it is to log into Umbraco from Postman...

Please Sign in or register to post replies

Write your reply to:

Draft