Closed filipebarcos closed 4 weeks ago
Hi @filipebarcos, apologies for the delay.
We extended functionality and allowed async functions to set up request headers, but we added it to Collect SDK, this SDK collect-js react
uses under the hood.
So, now you can try it.
Code example you can find here: https://github.com/verygoodsecurity/collect-js-react/blob/main/example/src/features/CustomPayload.tsx#L80-L92
Don't forget to use the latest version of Collect SDK: new version 2.25.1
This worked @flor-master. Thanks a bunch
Expected Behavior
Allow
headers
onsubmitParameters
to accept a callback function. I need to pass anAuthentication
header to the proxy/outbound URL, but I want to fetch the value for this header async/on demand.Current Behavior
Currently, via the docs, I see that is only possible to pass an object. Would be a similar behavior as we have for
data
.Context
This is because we integrate with Astra and to use their own vault, we must provide an access token for them to be able to create a card for our user on our behalf.
Tentative approaches with current behavior
the implementation of the
fetchAstraAuthHeader
looks like:The error:
DataCloneError: Failed to execute 'postMessage' on 'Window'