Starts in:
2 DAYS
0 HR
46 MIN
28 SEC
Starts in:
2 D
0 H
46 M
28 S
Open Closed

The required antiforgery cookie ".AspNetCore.Antiforgery.****" is not present. #2065


User avatar
0
Neozzz created

I have added a microservice service to a microservice solution. I followed the directions given in this doc: https://docs.abp.io/en/commercial/latest/startup-templates/microservice/add-microservice#running-the-solution

Then followed this doc: https://docs.abp.io/en/commercial/latest/startup-templates/microservice/synchronous-interservice-communication#updating-orderservice-application-contracts

Then did a migration and ran the project using:

tye run --watch

I am able to access the newly added end-point in swagger. But when I post data I get the error mentioned in the title.

The following is the trace.

Request starting HTTP/2 POST https://localhost:44337/api/app/product-type application/json 1122
2021-11-01 13:02:21.649 +04:00 [INF] Executing endpoint 'ZW.ProductSvc.ProductTypes.ProductTypeController.CreateAsync (ZW.ProductSvc.HttpApi)'
2021-11-01 13:02:21.660 +04:00 [INF] Route matched with {action = "Create", controller = "ProductType", area = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[System.Guid] CreateAsync(ZW.ProductSvc.ProductTypes.ProductTypeCreateDto) on controller ZW.ProductSvc.ProductTypes.ProductTypeController (ZW.ProductSvc.HttpApi).
2021-11-01 13:02:21.662 +04:00 [ERR] The required antiforgery cookie ".AspNetCore.Antiforgery.Schh12Bn9tQ" is not present.
2021-11-01 13:02:21.662 +04:00 [INF] Authorization failed for the request at filter 'Volo.Abp.AspNetCore.Mvc.AntiForgery.AbpAutoValidateAntiforgeryTokenAuthorizationFilter'.
2021-11-01 13:02:21.665 +04:00 [INF] Executing HttpStatusCodeResult, setting HTTP status code 400
2021-11-01 13:02:21.665 +04:00 [INF] Executed action ZW.ProductSvc.ProductTypes.ProductTypeController.CreateAsync (ZW.ProductSvc.HttpApi) in 5.2878ms
2021-11-01 13:02:21.665 +04:00 [INF] Executed endpoint 'ZW.ProductSvc.ProductTypes.ProductTypeController.CreateAsync (ZW.ProductSvc.HttpApi)'
2021-11-01 13:02:22.658 +04:00 [DBG] Added 0 entity changes to the current audit log
2021-11-01 13:02:22.658 +04:00 [DBG] Added 0 entity changes to the current audit log
2021-11-01 13:02:22.663 +04:00 [INF] Request finished HTTP/2 POST https://localhost:44337/api/app/product-type application/json 1122 - 400 0 - 1016.7524ms

Please let me know what might be causing this issue.

Thank you


29 Answer(s)
  • User Avatar
    0
    Neozzz created

    Do you want me to add a new microservice service to the template? I am sorry I didn't understand.

    If you wanna check the existing copy I shared in github, you can just tye run that microservice solution and then post data into leave-type. Sample post data is in the github repo. When I post the data, I get the error, and I copied the error from the gateway logs.

    I am not sure I understand what you want me to do, sorry; could you please elaborate.

    Tx

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Create a new microservice project. Then use the simplest code to reproduce the problem.

    Please use docker environment instead of your own database and redis etc..

  • User Avatar
    0
    Neozzz created

    hi liang,

    creating a new microservice project is easy, but adding another service , then adding references that were not mentioned in the doc and taking reference from existing product-service etc. takes a long time to wire it up. Are you sure this is the only way out? Could you take remote and check, if that'd help?

    Please let me know.

    Thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    This can quickly find and solve problems.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06