Open Closed

Getting 400 (bad request) in swagger after executing the POST api #10247


0
shedspotter created
  • What is your product version = 9.0.1
  • What is your product type = Angular
  • What is product framework type = .net core

If issue related with ABP Framework

  • What is ABP Framework version = 5.10.1

Hi , I am calling the API in swagger and it give me 400 (bad request) but when I have tried to execute the same API using POST man I am able to execute the API. So I investigate it furture and check the logs in azure app service , I got an expection when I am trying to do the post call from swagger.It gives me folling error : idateAntiforgeryTokenAuthorizationFilter - The provided antiforgery token was meant for a different claims-based user than the current user. Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The provided antiforgery token was meant for a different claims-based user than the current user.. It's strange as the same API is working correctly in Postman but not in swagger.

Screen shots for log

screen shot of swagger

screen shot of postman using same api

Please provide a solution as soon as possible

Thanks


10 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi,

    You can reply your swagger html and js files with the latest ones https://github.com/aspnetzero/aspnet-zero-core/tree/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Host/wwwroot/swagger/ui.

    Then, it should work.

  • 0
    shedspotter created

    Hi ismcagdas , as I have navigated the link shared by you but html and js files not update. last update on these page are 2 yr back

  • 0
    ismcagdas created
    Support Team

    Hi @shedspotter

    Does this error happen when you visit the website in a incognito mode ?

    Thanks,

  • 0
    shedspotter created

    Hi @ismcagdas , no in normal window we are facing this issue and also now when I am trying to access the API in post man it gives me unsuppoerted media type as error and also I have tried https://support.aspnetzero.com/QA/Questions/6969/Error-405-on-Swagger-with-update-and-delete-service#answer-22bcbe8f-c259-b28b-3e98-39eda8d8ab08 but is not working

  • 0
    ismcagdas created
    Support Team

    Hi @shedspotter

    Is it possible to share your project with us via email ?

  • 0
    shedspotter created

    Hi @ismcagdas , I will give you the credientials for accessing the application, please share your email

    Thanks

  • 0
    ismcagdas created
    Support Team

    Hi @shedspotter

    Please send it to info@aspnetzero.com.

    Thanks,

  • 0
    shedspotter created

    I have send it the credientials info@aspnetzero.com. with ticket

  • 0
    ismcagdas created
    Support Team

    Hi @shedspotter

    Thanks, got it and will check soon.

  • 0
    shedspotter created

    Hi @ismcagdas is there any update on the above issue