Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Custom lib (or logic) #24

Open
yovanoc opened this issue May 14, 2020 · 5 comments
Open

Custom lib (or logic) #24

yovanoc opened this issue May 14, 2020 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@yovanoc
Copy link

yovanoc commented May 14, 2020

It would be good to let the user choose the implementation for his JWT methods (sign, verify etc).
or another lib like jose

@Camji55
Copy link
Owner

Camji55 commented May 16, 2020

@yovanoc, The latest release, v1.1.0 https://github.com/Camji55/nexus-plugin-jwt-auth/releases/tag/v1.1.0 adds a setting to pass in custom verify logic. I'll leave this Issue open for the time being because I would like to get it documented and possibly add a sign setting.

@AzSiAz
Copy link
Contributor

AzSiAz commented Jun 10, 2020

Possible to add an "async" verify, to use with something like this:

import * as jwt from 'jsonwebtoken'

export const verifyToken = (req: Request, next) => {
    const token = extractToken(req)
    jwt.verify(token, getKey, (err, decoded) => {
        next(decoded)
    })
}

My purpose is to verify a token from auth0

@Camji55 Camji55 self-assigned this Jun 10, 2020
@Camji55 Camji55 added the enhancement New feature or request label Jun 10, 2020
@Camji55 Camji55 added this to To do in JWT Auth Nexus Plugin Jun 11, 2020
@fflores97
Copy link

May I also suggest making the appSecret argument optional? If one implements any non-secret-based JWT verification (as is the case with @AzSiAz and myself), the secret isn't used in the logic at all.

@Camji55
Copy link
Owner

Camji55 commented Jul 31, 2020

May I also suggest making the appSecret argument optional? If one implements any non-secret-based JWT verification (as is the case with @AzSiAz and myself), the secret isn't used in the logic at all.

@fflores97 & @AzSiAz: Would this work for y'all? https://github.com/Camji55/nexus-plugin-jwt-auth/pull/45/files

@fflores97
Copy link

Looks great! Way better than the hacky thing I put together hahaha. Thanks for the work @Camji55 !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

4 participants