Giter VIP home page Giter VIP logo

authey's Issues

@auth/core needs version bump

Hi there ๐Ÿ‘‹

I just started a POC using your lib along with @auth/core. Seems to be working great so far, but i'm getting a peer dependency error from authey because @auth/core is now on 0.10.0.

npm ERR! While resolving: [email protected]
npm ERR! Found: @auth/[email protected]
npm ERR! node_modules/@auth/core
npm ERR!   @auth/core@"^0.10.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @auth/core@"^0.9.0" from [email protected]
npm ERR! node_modules/authey
npm ERR!   authey@"^0.7.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @auth/[email protected]
npm ERR! node_modules/@auth/core
npm ERR!   peer @auth/core@"^0.9.0" from [email protected]
npm ERR!   node_modules/authey
npm ERR!     authey@"^0.7.0" from the root project

@auth/core Dependency Update

I'd love to use this in my nuxt app, but the @auth/core dependency is a few versions behind.

I get this error when trying to install authey alongside the latest version of @auth/core:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: @auth/[email protected]
npm ERR! node_modules/@auth/core
npm ERR!   @auth/core@"^0.5.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @auth/core@"^0.3.0" from [email protected]
npm ERR! node_modules/authey
npm ERR!   authey@"*" from the root project

RequestInit in fetch duplex option is required when sending a body

Related nodejs/node#46221

{
  "type": "TypeError",
  "message": "RequestInit: duplex option is required when sending a body.",
  "stack":
    TypeError: RequestInit: duplex option is required when sending a body.
      at new Request (node:internal/deps/undici/undici:7225:19)
      at createNodeRequest (file:///___/node_modules/authey/dist/index.mjs:32:10)
      at file:///___/node_modules/authey/dist/index.mjs:105:23
      at Holder.done (___\node_modules\@fastify\middie\engine.js:112:11)
      at Object.run (___\node_modules\@fastify\middie\engine.js:59:12)
      at Object.runMiddie (file:///___/node_modules/fastify-next-auth/dist/index.mjs:21:12)
      at hookIterator (___\node_modules\fastify\lib\hooks.js:293:10)
      at next (___\node_modules\fastify\lib\hooks.js:185:16)
      at handleResolve (___\node_modules\fastify\lib\hooks.js:196:5)
}

Adding duplex: 'half' between line 30 & 31 in src/fetch.ts fixes it.

https://github.com/wobsoriano/authey/blob/main/src/fetch.ts#L24-L37

Running Node.js v18.16.0, fastify 4.16.3, fastify-next-auth 0.3.0

`options` destructuring breaks setting default values

I think there was a mix up here with what looks like attempting to set default values for some of the provided options to both createAuthMiddleware and getSession.

In the following code:

authey/src/index.ts

Lines 65 to 72 in a49cccd

const {
prefix = '/api/auth',
conform = (_: Request) => (res: Response) => res,
...authOptions
} = options
options.secret ??= process.env.AUTH_SECRET
options.trustHost ??= shouldTrustHost()

You can see that both options.secret and options.trustHost are set after being destructured to authOptions.

Perhaps something like the following was intended:

  const {
    prefix = '/api/auth',
    conform = (_: Request) => (res: Response) => res,
    ...authOptions
  } = options

  authOptions.secret ??= process.env.AUTH_SECRET
  authOptions.trustHost ??= shouldTrustHost()

The same issue applies to getSession.

nit: i would argue that the previous form was also not the best as it was mutating the options passed in to the function, which consumers may not be expecting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.