hi.. how to pass a header in Thirdparty.signinup({...
# support-questions-legacy
s
hi.. how to pass a header in Thirdparty.signinup({}).. tried options: { requestInit: { headers: { "x-referral-code": localStorage.getItem("referral"), }, }, }, but this doesnt work.. and also this ThirdParty.init({ preAPIHook: async (request) => { request.requestInit.headers["x-referral-code"] = localStorage.getItem("referral"); }, }),
n
Hi
What sdk are you using?
s
this is the backend code for signinup.. im using starlette
web sdk
n
Make sure to return the modified request init from the
preAPIHook
Something like this would work
Copy code
ThirdParty.init({
      preAPIHook: async (request) => {
        request.requestInit.headers["x-referral-code"] =
          localStorage.getItem("referral");
        return request;
      },
    }),
s
ok thanks ill try
3 Views