danestves / remix-auth-auth0

An Auth0Strategy for Remix Auth, based on the OAuth2Strategy
MIT License
121 stars 22 forks source link

V2 - oauth2 upgrade #110

Open atomicpages opened 4 months ago

atomicpages commented 4 months ago

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