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

Fix store to use cookieName #150

Open
nowells opened this issue Dec 18, 2024 · 1 comment
Open

Fix store to use cookieName #150

nowells opened this issue Dec 18, 2024 · 1 comment

Comments

@nowells
Copy link

nowells commented Dec 18, 2024

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch remix-auth-oauth2@3.2.0 for the project I'm working on.

We set a different cookieName, and on oauth2 return, it was breaking as the callback did not use the cookieName.

Here is the diff that solved my problem:

diff --git a/node_modules/remix-auth-oauth2/build/index.js b/node_modules/remix-auth-oauth2/build/index.js
index 4a3ee82..7fca029 100644
--- a/node_modules/remix-auth-oauth2/build/index.js
+++ b/node_modules/remix-auth-oauth2/build/index.js
@@ -58,7 +58,7 @@ export class OAuth2Strategy extends Strategy {
         let code = url.searchParams.get("code");
         if (!code)
             throw new ReferenceError("Missing code in the URL");
-        let store = StateStore.fromRequest(request);
+        let store = StateStore.fromRequest(request, this.cookieName);
         if (!store.has()) {
             throw new ReferenceError("Missing state on cookie.");
         }

This issue body was partially generated by patch-package.

@oliver-wymer
Copy link

Had the same issue, this patch did fix it 👍

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

2 participants