Copied to clipboard

Flag this post as spam?

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


  • Jonas Boman 6 posts 27 karma points
    Jun 20, 2023 @ 07:59
    Jonas Boman
    0

    302 on UmbracoApiController in Umbraco 10

    Hi all!

    Since upgrading to v10 I am unable to get a success request from api

     [HttpGet]
        [Route("~/api/v2/event/info/{eventId:int}/aid/{aidId:int}/date/{dateId:guid}")]
        [Authorize(Roles = "CustomRole")]
        public IActionResult CheckEvent(int eventId, int aidId, Guid dateId)
        { }
    

    I would guess the user context is lost and the Authorize attribute is not met, therefor throwing a 302.

    This worked fine in version 9.

    The request itself is made with javascript, with click of a button; implemented in Vue. I could use the regular PageController instead, but perhaps its a quick fix for making it work as it did before?!

    Thanks in advance.

  • Jonas Boman 6 posts 27 karma points
    Jun 21, 2023 @ 09:47
    Jonas Boman
    0

    The solution was to change the Authorize attribute to

            [UmbracoMemberAuthorize("","CustomRole","")]
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies