APIs & Integrations

newMember
Participant

Submit form in incognito mode

SOLVE

Hiii,

    I need to submit a form. When it is a non-incognito mode, the form gets submitted. But if I am trying to send it from icognito window, it will throw error as "INVALID HUTK".

I have written a condition as 

$hubspotutk = isset($_COOKIE['hubspotutk']) ? $_COOKIE['hubspotutk'] : 'hutk';

I had tried with empty cookie value as

$hubspotutk = isset($_COOKIE['hubspotutk']) ? $_COOKIE['hubspotutk'] : '';

But it throwed the same error as above.

 

Is there any way to handle form submission in incognito mode??? 

Can someone help please?

0 Upvotes
1 Accepted solution
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Submit form in incognito mode

SOLVE

Hey @newMember,

 

How are you passing the cookie if there's no cookie? If you're passing in an empty cookie, the Form submission would throw the following error:

  • INVALID_HUTK - The hutk field in the context object is invalid.

 

If you're indeed passing in an empty cookie, I'd suggest for you to implement this logic:

1. Check if hutspotutk is present

2. If it's present, include it in the form data

3. If it's not present, the form data should not have the context hutk.

View solution in original post

2 Replies 2
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Submit form in incognito mode

SOLVE

Hey @newMember,

 

How are you passing the cookie if there's no cookie? If you're passing in an empty cookie, the Form submission would throw the following error:

  • INVALID_HUTK - The hutk field in the context object is invalid.

 

If you're indeed passing in an empty cookie, I'd suggest for you to implement this logic:

1. Check if hutspotutk is present

2. If it's present, include it in the form data

3. If it's not present, the form data should not have the context hutk.

leshapol
Member

Submit form in incognito mode

SOLVE

In our case, if we do not pass a hutk, then we get an error 400. 

How can I send a request with an empty value hutk?

0 Upvotes