# Anit-forgery cookie in Bubble

**URL:** <https://forum.bubble.io/t/anit-forgery-cookie-in-bubble/38661>\
**Category:** APIs\
**Created:** [September 25, 2018, 3:02pm UTC](https://forum.bubble.io/t/anit-forgery-cookie-in-bubble/38661 "2018-09-25T15:02:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aditya.rajak](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/aditya.rajak/32/40586_2.png) [@aditya.rajak](https://forum.bubble.io/u/aditya.rajak)\
**Post date:** [September 25, 2018, 3:02pm UTC](https://forum.bubble.io/t/anit-forgery-cookie-in-bubble/38661/1 "2018-09-25T15:02:37Z")

</div>

How to deal with the Anti-forgery cookie in Bubble.  
I am facing the problem in which I am unable to upload a file. This file upload process needs a POST method to be run and then generate the output in JSON form. However, this POST method needs cookie and CSRF token in the Header of the method. I am getting these token and cookie from 2 other API’s, which are ‘login’ and ‘generate token’. I am getting this error while I am trying to upload a file from Bubble’s API connector. See the error.

 ![Bubble%20Plugin%20Editor%20%20%20SolveXia%20(1)](https://us1.discourse-cdn.com/bubble/original/3X/7/5/7518087a97478dee5fb8f27ab9b3979b21d0f40b.png)

I strongly believe that API’s AspNet anti-forgery token is preventing cookie re-creation (in other words prevents hijacking);

I believe, Bubble should have a way to deal with anti-forgery tokens and passing session/cookie in the more elegant way.

Did anybody have this kind of issue earlier?

---

<div class="post-metadata">

**Author:** ![JohnMark](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/johnmark/32/42431_2.png) [@JohnMark](https://forum.bubble.io/u/JohnMark)\
**Post date:** [September 25, 2018, 10:48pm UTC](https://forum.bubble.io/t/anit-forgery-cookie-in-bubble/38661/2 "2018-09-25T22:48:25Z")

</div>

The error said at the end: ‘meant for a different user than the current user’. Maybe is the clue? I only guess here as you have not receiving any answer yet… 🤨

 ![15%20PM](https://us1.discourse-cdn.com/bubble/original/3X/1/e/1e81dd736376232e4de3f955752d2e09a9913911.png)

---

<div class="post-metadata">

**Author:** ![aditya.rajak](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/aditya.rajak/32/40586_2.png) [@aditya.rajak](https://forum.bubble.io/u/aditya.rajak)\
**Post date:** [September 26, 2018, 7:01am UTC](https://forum.bubble.io/t/anit-forgery-cookie-in-bubble/38661/3 "2018-09-26T07:01:53Z")

</div>

Thanks for commenting @JohnMark, I have tested the same methods in Postman as well. Things are working fine there. Only in Bubble that kind of error, I am facing. This is weird.  
Also when I am logging in the user, passing the same username and password which I’m providing in the Postman.

---

<div class="post-metadata">

**Author:** ![JohnMark](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/johnmark/32/42431_2.png) [@JohnMark](https://forum.bubble.io/u/JohnMark)\
**Post date:** [September 26, 2018, 1:16pm UTC](https://forum.bubble.io/t/anit-forgery-cookie-in-bubble/38661/4 "2018-09-26T13:16:55Z")

</div>

When I got some weird stuff, I usually test on a different OS, different computer and different network, just to be sure. Often 😅 isn’t Bubble, but another conflict. After that, I send a bug report if it’s not solved with a working bug.

---

<div class="post-metadata">

**Author:** ![mebeingken](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mebeingken/32/20139_2.png) [@mebeingken](https://forum.bubble.io/u/mebeingken)\
**Post date:** [September 26, 2018, 1:29pm UTC](https://forum.bubble.io/t/anit-forgery-cookie-in-bubble/38661/5 "2018-09-26T13:29:51Z")

</div>

Try explicitly setting the content-type. If that doesn’t work you might consider posting your api connector settings so people can take a look.

---

<div class="post-metadata">

**Author:** ![aditya.rajak](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/aditya.rajak/32/40586_2.png) [@aditya.rajak](https://forum.bubble.io/u/aditya.rajak)\
**Post date:** [September 27, 2018, 7:17am UTC](https://forum.bubble.io/t/anit-forgery-cookie-in-bubble/38661/6 "2018-09-27T07:17:12Z")

</div>

haha, seems like I also need to send a bug report.  
Because I have done all the experiments which were supposed to be done like different OS and computer.

---

<div class="post-metadata">

**Author:** ![aditya.rajak](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/aditya.rajak/32/40586_2.png) [@aditya.rajak](https://forum.bubble.io/u/aditya.rajak)\
**Post date:** [September 28, 2018, 10:24am UTC](https://forum.bubble.io/t/anit-forgery-cookie-in-bubble/38661/7 "2018-09-28T10:24:24Z")

</div>

I have some weird outputs while I am getting the responses. When I generate the Token in Postman, it gives me the Token in 199 lengths of characters and when I generate the Token in the Bubble, it generates the Token in 156 lengths of characters.

Also when I am using the Token, generating from the Postman and uses it in the Bubble method, it works. But the Token of 156 lengths of characters doesn’t.

I am clueless now. ☹
