remix-auth-auth0 icon indicating copy to clipboard operation
remix-auth-auth0 copied to clipboard

V2 - oauth2 upgrade

Open atomicpages opened this issue 7 months ago • 0 comments

Bumped remix-auth-oauth2 to v2 which caused breaking changes in this package. The shape of the verify response has changed and appending non-standard custom query string params doesn't appear to be working:

test("should allow additional search params", async () => {
  const strategy = new Auth0Strategy(
    {
      domain: "test.fake.auth0.com",
      clientID: "CLIENT_ID",
      clientSecret: "CLIENT_SECRET",
      callbackURL: "https://example.app/callback",
    },
    verify,
  );

  const request = new Request("https://example.app/auth/auth0?test=1");

  try {
    await strategy.authenticate(request, sessionStorage, BASE_OPTIONS);
  } catch (error) {
    if (!(error instanceof Response)) throw error;
    const location = error.headers.get("Location");

    if (!location) throw new Error("No redirect header");

    const redirectUrl = new URL(location);

    // FAILS
    expect(redirectUrl.searchParams.get("test")).toBe("1");
  }
});

https://github.com/sergiodxa/remix-auth-oauth2/blob/e35cd155b8f8ffdbb0f1047f1101f6493d2757f5/src/index.ts#L138 is no longer pulling custom url params

p.s. this contains commits from #109 as well

atomicpages avatar Jul 14 '24 17:07 atomicpages