Not sure if this is the right place for this, but ...
# general
g
Not sure if this is the right place for this, but we're implementing the permit-fe-sdk and have run into an issue. We need to pass withCredentials = true on the requests to our back end server, but I don't think the axios request that the permit-fe-sdk makes allows for that to be set. We've tried adding it in the customHeaders, but that's not working. I think we need to be able to pass another parameter to the axios.post call for withCredentials = true. Do you have any advice on how to proceed?
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
o
Hi thanks for reaching out. for future reference the right place to ask is #C02RTML2WNN. I'll escalate this to the team to check, in the meanwhile let's ask @Ask Inkeep
thanks 1
a
Thanks for tagging me @Or Weis. I'll look through relevant sources and get back to you shortly.
Looking at the
permit-fe-sdk
source code, the SDK does support
customRequestHeaders
but you're correct that
withCredentials
is an Axios request config option, not a header. (1) The current implementation passes headers like this:
Copy code
const config = headers ? { headers } : {};
This means the SDK currently only forwards custom headers, not other Axios config options like
withCredentials
. ​*Workaround options:*​ 1. ​*Proxy approach*​: Set up a same-origin proxy on your backend so CORS credentials aren't needed. 2. ​*Fork/contribute*​: Since the SDK is open source, you could fork it and modify the axios calls to include
withCredentials: true
, or submit a PR to add support for additional Axios config options. The
PermitProps
interface currently accepts:
Copy code
export type PermitProps = {
  loggedInUser: string;
  userAttributes?: Record<string, any>;
  backendUrl: string;
  defaultAnswerIfNotExist?: boolean;
  customRequestHeaders?: AxiosRequestHeaders;
};
Adding something like
axiosConfig?: AxiosRequestConfig
would be the ideal enhancement to support your use case. I'd recommend opening an issue or PR on the permit-fe-sdk GitHub repo to request this feature.
z
Hi @Garrett Johnson , we made a pull request for this feature, will merge it tomorrow after review.
Hi @Garrett Johnson, please see the new version with your requested feature.
g
This looks great. Thank you so much! I'll get our version updated today
💜 1