Hello ! I am facing a CORS issue while trying to c...
# talk-kratos
q
Hello ! I am facing a CORS issue while trying to create a login flow from my vue app. My Ory instance is port-forwarded locally and was deployed using helm chart with CORS options correctly set but it still persist. Here is my exact error :
Copy code
ccess to XMLHttpRequest at '<http://127.0.0.1/self-service/login/browser?refresh=true&aal=aal1>' from origin '<http://127.0.0.1:3000>' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Here is the non-working code part :
Copy code
orySdk
    .createBrowserLoginFlow({ refresh: true, aal: aal2 ? 'aal2' : 'aal1' })
    .then(({ data: flowData }) => {
      console.log('query ? ')
      this.$router.query.delete('flow')
      flow.value = flowData
    })
    .catch(
      sdkErrorHandler
    )
And here is my sdk config :
Copy code
export const orySdk = new FrontendApi(
  new Configuration({
    basePath: import.meta.env.VITE_ORY_API_URL,
    // we always want to include the cookies in each request
    // cookies are used for sessions and CSRF protection
    baseOptions: {
      withCredentials: true
    }
  })
)
Thank you for reading this !
g
If I’m not mistaken, the port is part of the host and therefore the origin doesn’t match (
127.0.0.1:3000 != 127.0.0.1
)