Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oidc-auth: No 'Access-Control-Allow-Origin' header CORS error #706

Open
mkstowe opened this issue Aug 22, 2024 · 0 comments
Open

oidc-auth: No 'Access-Control-Allow-Origin' header CORS error #706

mkstowe opened this issue Aug 22, 2024 · 0 comments

Comments

@mkstowe
Copy link

mkstowe commented Aug 22, 2024

Using the oidc-auth middleware with Auth0, I get a CORS error stating that the Access-Control-Allow-Origin header is not set. I'm not sure if this middleware is supposed to handle this or not, but the header is present when I don't use it. I am using the cors middleware as well.


My basic app/middleware setup:

const app = new Hono();

app.use(
  cors({
    origin: ["*"],
  })
);

app.use("*", oidcAuthMiddleware())

The error when trying to access any endpoint:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://<domain>.us.auth0.com/authorize?client_id=.... (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 302.

In Auth0, I do have the allowed callback urls and allowed web origins set as my app's url (currently just localhost:4200). I'm not sure if my issue lies in the setup of oidc-auth, cors, or both. Any help would be greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant