HTTP requests from client

Hi there,

I currently have prodigy exposed inside my company's network as a containerized application running in AWS. Users are authenticated through AWS's load balancer using Okta.

When users submit an answer, I am using the validate_answer callback to send the results to a bucket in S3. About every 20-30 answers I am getting an authentication error from Okta that originates from the validate_answer function that gets included in the bundle.js. I found one work around in the Okta developer forum (https://devforum.okta.com/t/blocked-by-cors-policy-when-redirect-to-authorize/10135/6) but it requires that I make an HTTP request from the client-side. I tried to use requests to make the call from the custom recipe that I'm using, but it doesn't seem to work. Is there any way to make a request from the client side?

Hi! So if I understand the question correctly, you want to make a request from the Prodigy web app, not the server (which would be any code in a custom recipe), right? One option could be to use the "javascript" config setting in your recipe to provide JavaScript to be executed by the web app: https://prodi.gy/docs/custom-interfaces#js-css

How important is it to you that the answers are sent to the bucket in real time before each submission? It seems like the update callback with a lower batch size might be a better fit and will require fewer requests. The validate_answer callback is called on every submission and it will fire multiple times if you undo etc., so it feels a little overkill. But of course, there are always use cases where it does make sense.

That's exactly what I needed! Also that's a good suggestion to use update instead. Thanks for the help, Ines!

1 Like