# Auth0 with nextjs and graphql (client / server architecture)

**URL:** <https://community.auth0.com/t/auth0-with-nextjs-and-graphql-client-server-architecture/50692>\
**Category:** Get Help\
**Tags:** graphql, nextjs\
**Created:** [September 30, 2020, 1:17am UTC](https://community.auth0.com/t/auth0-with-nextjs-and-graphql-client-server-architecture/50692 "2020-09-30T01:17:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmwill934](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gmwill934/32/22277_2.png) [@gmwill934](https://community.auth0.com/u/gmwill934)\
**Post date:** [September 30, 2020, 1:17am UTC](https://community.auth0.com/t/auth0-with-nextjs-and-graphql-client-server-architecture/50692/1 "2020-09-30T01:17:22Z")

</div>

Hello

I would like to `authenticate` and `authorize` users using auth0.

I’m a little lost, any pointers would be appreciated.

My app is using `Next JS` for the client/frontend and `GraphQL` (typescript / type-graphql) for the server/backend.

I see the flow as follows.

1. User logs in to the application successfully
2. A JWT is attached/exposed to the request object
3. I can pass/expose `req.headers.authorization` on `context` on GraphQL.
4. Handle the `req` object on `type-graphql` with custom decorators.
5. Validate if user is “authorized” to access `resolver`

- One of the questions I have is how to handle authentication on a SSG/SSRS hybrid scenario?  
(since static generation happens on the client I will not have access to the `req`object.)

- Does the library `auth0/nextjs-auth0` uses `jsonwebtokens` and attaches the decoded user on the req object (if success login)?

- Do I need additional middleware in order to use JWT?

- Should I validate JWT for authorization using a JWKS? (on resolvers)

Thanks!

---

<div class="post-metadata">

**Author:** ![marcusorjames](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcusorjames/32/25382_2.png) [@marcusorjames](https://community.auth0.com/u/marcusorjames)\
**Post date:** [November 3, 2020, 8:59am UTC](https://community.auth0.com/t/auth0-with-nextjs-and-graphql-client-server-architecture/50692/2 "2020-11-03T08:59:43Z")

</div>

I am also interested in implementing a similar stack. Did you get anywhere with this? I will let you know how I get on.
