sst / ion

SST v3
https://sst.dev
MIT License
1.88k stars 221 forks source link

Allow CORS override for Auth function url #493

Closed jbrown closed 3 months ago

jbrown commented 4 months ago

In order to get the code adapter working I had to include the credentials in the /callback fetch request, but the browser will error if the allowed origins is set to '*'. This change allowed me to do the following:

const auth = new sst.aws.Auth("Auth", {
  authenticator: {
    handler: "./infra/auth.handler",
    url: {
      cors: {
        allowCredentials: true,
        allowHeaders: ["content-type"],
        allowMethods: ["*"],
        allowOrigins: ["http://localhost:3000"]
      }
    },
  },
});

Note: the Auth function must have a url so if you tried to pass false it would still be true.

Fixes #517

jayair commented 3 months ago

Hmm we need to review this. Is there an issue attached to this? If not, if you could open one and link to it.

jbrown commented 3 months ago

@jayair Please see issue #517 for more details and a repo to reproduce

jbrown commented 3 months ago

Closing as I misunderstood how the Auth flow worked.