pbteja1998 / remix-auth-email-link

MIT License
92 stars 22 forks source link

sessionMagicLinkKey default value typo #35

Closed atoi closed 1 year ago

atoi commented 1 year ago

Describe the bug

The class documentation tells the default value for sessionMagicLinkKey uses camelCase.

  /**
   * The key on the session to store the magic link.
   * @default "auth:magicLink"
   */
  sessionMagicLinkKey?: string

The code examples in the README use lowercase.

  // This session key `auth:magiclink` is the default one used by the EmailLinkStrategy
  // you can customize it passing a `sessionMagicLinkKey` when creating an
  // instance.
  return json({
    magicLinkSent: session.has('auth:magiclink'),
    magicLinkEmail: session.get('auth:email'),
  })

Here we can see, that lowercase is the right way to go if you want make things work. https://github.com/pbteja1998/remix-auth-email-link/blob/main/src/index.ts#L173

this.sessionMagicLinkKey = options.sessionMagicLinkKey ?? 'auth:magiclink'

So, I suppose either the docs or the default value should be corrected.
Otherwise some people may have quite a bit of fun debugging their auth code, trying to figure out why the link is not there.

Your Example Website or App

Does not really need stackblitz

Steps to Reproduce the Bug or Issue

  1. Look here https://github.com/pbteja1998/remix-auth-email-link/blob/main/src/index.ts#L100
  2. Then look here https://github.com/pbteja1998/remix-auth-email-link/blob/main/src/index.ts#L173

Expected behavior

Screenshots or Videos

No response

Platform

Additional context

No response

pbteja1998 commented 1 year ago

Thank you. Fixed it!