Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

feat (guard): add possibility to get access token from cookie #8

Closed
wants to merge 2 commits into from

Conversation

chramos
Copy link

@chramos chramos commented May 5, 2022

I'm using this library in a personal project and I need to get access token from cookies and it is not possible so far.
This change allow us to provide the access token to the guard class from auth.config file

e.g:

//config/auth.ts
 basic: {
 },
jwt: {
  ...{ALL_JWT_CONFIG}
  getBearerToken: (ctx) => {
      const token = ctx.request.cookie('authorization')
      if (token) {
        return token
      }
      return ''
   },
}

if nothing was provided in the auth.config file, the default getBearerToken will be executed

@maxgalbu
Copy link
Owner

Apart from the comments, this looks good to me! Please review the commits and I'll merge it

@maxgalbu maxgalbu closed this in 548ea89 Jun 17, 2022
@claudesortwell
Copy link

Any chance we can re open this? I'm happy to make any changes you need.

I've implemented this but using patch-package.

@maxgalbu
Copy link
Owner

maxgalbu commented Aug 9, 2022

Actually, it was merged as you can see just above your comment (in 548ea89). I just didn't release any version, I was working on the MongoDb adapter. I'll release a new version with this fix

@maxgalbu
Copy link
Owner

maxgalbu commented Aug 9, 2022

@claudesortwell
Copy link

Sorry about that seemed to have missed that, and thanks for updating the version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants