We are having an issue with our hosted api on verc...
# support-questions
e
We are having an issue with our hosted api on vercel (nextjs)... The cookies are not set when requesting from a different origin (for example: capacitor://localhost)
r
The issue is that the sameSite was "lax" and not "none"
if you set the right websiteDOmain / apiDomain values (to reflect vercel URLs) then it should be fine
Maybe this will help
e
I see, my bad! I've refactored the code, added FRONTEND_URL to our shared config. But it should be app specific
Copy code
js
export const appInfo = {
  appName: 'Lokalist Webshop',
  apiDomain: FRONTEND_URL,
  websiteDomain: FRONTEND_URL,
  apiBasePath: '/api/auth',
  websiteBasePath: '/auth',
}
error was pretty clear, sorry for disturbing 😦
In this case,
websiteDomain: process.env.VERCEL_URL,
Which i had before, but removed oops
r
sounds good! hope it works now
e
One problem, not sure if I get it tho... our website domain on the apps (capacitor) depends on the platform
r
what do you mean by platform?
e
for iOS the domain (origin) =
capacitor://localhost
android its
http://localhost
our web version it's
FRONTEND_URL
(the same i'm using on the backend)
r
So you want to set it to your web version
So for things like reset password emails, it will redirect the user to the web version - if that works for you
e
Right, I've fixed the redirect already ;) Got it. Thanks!
r
👍
e
@rp problem wasnt the lax
Copy code
js
export default function getCookieHandler(original: CookieHandlerInterface): CookieHandlerInterface {
  return {
    ...original,
    getCookie: async function () {
      const cookies = await getCookiesFromStorage()
      console.log({ cookies })
      return cookies
    },
    setCookie: async function (cookieString: string) {
      await setCookieToStorage(cookieString)
    },
  }
}
I didnt await the setCookieToStorage
r
oh right
does it work now?
e
ye it works 😉
r
awesome
e
pff was hard to figure out hehe, thanks anyways
r
yea fair enough
2 Views