Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Headless Optimizely Forms, posting a form

Vote:
0
I'm struggling with posting a form to the forms api.
 
I'm using these packages:
EPiServer.CMS 12.34
EPiServer.ContentDeliveryApi.Cms 3.12.0
Optimizely.Cms.Forms.Service 1.2.0
Optimizely.Cms.Forms.ContentGraph 1.2.0
 
I tried to look at these links:
 
In my React site, fetching and rendering the form with https://github.com/episerver/content-headless-form-js-sdk works fine.
However, when posting, it returns a 401.
My forms at the site should be allowed to be posted without logging in.
 
For users accessing the CMS, OpenIdConnect has been added, which works, allowing users to log in, etc.
 
I tried adding AddOpenIDConnectUI, as mentioned in the link above, but had no luck.
Any suggestions or examples to get it working would be much appreciated.
 
#337187
Mar 13, 2025 15:26
Vote:
0

The client authentication have nothing to do with the user being anonymous or not. You will still need to send a bearer token to the Forms API to verify that your client have the permission to post stuff.

Ideally you'll post to your own API and not directly to the forms api. Your own API will in its turn be the one holding the JWT Bearer Token sending it to the forms api. This should be done serverside.

 

#337203
Mar 14, 2025 11:09
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.