Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support: Implementation with NEstJS functional? #63

Open
m3c-ode opened this issue Jun 20, 2022 · 7 comments
Open

Support: Implementation with NEstJS functional? #63

m3c-ode opened this issue Jun 20, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@m3c-ode
Copy link

m3c-ode commented Jun 20, 2022

Description

Hi there, just a support question:

I've been trying to implement auth0 to use for our NestJs app.

I followed your tutorial on youtube: https://www.youtube.com/watch?v=JzndSOAb6SQ
But this video uses not this actual package, but the other ones that were previously in place (express-jwt, express-jwt-authz, and jwks-rsa)

I'm just curious to know if this new one is easily implementable for a NestJs app as well?
and How different should it be done?

@adamjmcgrath
Copy link
Contributor

Hi @m3c-ode - thanks for raising this

Currently we only publish express-oauth2-jwt-bearer for Express.js apps - but if you can get Nest.js working with express-jwt there's no reason why you couldn't get express-oauth2-jwt-bearer working with Nest.js - I don't have an example for you though.

We'd like to natively support other frameworks in the future, but currently that's just limited to Express.js

@adamjmcgrath adamjmcgrath added the enhancement New feature or request label Jun 22, 2022
@m3c-ode
Copy link
Author

m3c-ode commented Jun 22, 2022 via email

@tolgap
Copy link

tolgap commented Jun 27, 2022

@adamjmcgrath Please consider publishing access-token-jwt and oauth2-bearer so the community can build custom solutions. 😄

It's not the NestJS way to utilize middleware to perform auth and authz.

@nfadili
Copy link

nfadili commented Oct 5, 2022

For anyone else looking to use this middleware with Nest, you can try something like this in your app.module.ts:


import { MiddlewareConsumer, Module, RequestMethod } from '@nestjs/common';
import { auth } from 'express-oauth2-jwt-bearer';

@Module({
    imports: [],
    controllers: [],
    providers: []
})
export class AppModule {
    configure(consumer: MiddlewareConsumer) {
        consumer
            .apply(
                auth({
                    issuerBaseURL: process.env.AUTH0_ISSUER,
                    audience: process.env.AUTH0_AUDIENCE
                }),
                // ... any other middleware
            )
            .forRoutes({
                path: '*',
                method: RequestMethod.ALL
            });
    }
}

@tomaszferens
Copy link

auth0-access-token-jwt Is it really the only way to use Auth0 with Node.js (no express) to verify access tokens? I just have accessToken string and want to verify it, why is it so complicated?

@tomaszferens
Copy link

I have an electron desktop app that communicates with my Node.js API. The electron app sends access token in a Authorization header, like this: Authorization: Bearer <access_token>. I set it manually for each http request, not a big deal. The access token comes from Auth0. How can I verify this token in my Node.js server? @adamjmcgrath

@h4sohail
Copy link

@adamjmcgrath Please consider publishing access-token-jwt and oauth2-bearer so the community can build custom solutions. 😄

It's not the NestJS way to utilize middleware to perform auth and authz.

This would be great to have!

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

No branches or pull requests

6 participants