Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 968 Bytes

auth.md

File metadata and controls

19 lines (13 loc) · 968 Bytes

Authentication

  • Easiest way to implement auth in GraphQL service is to use graphql-http + middlewares.`

  • Do it like you do normally in your ExpressJS or NestJS app inside a middleware.

  • The request object is accessible as the second arg in your resolver.

  • E.g. to access IP in your resolver you can follow these steps:

    Attach IP to the resolver context argument

  • And for securing your GraphQL with JWT we have a couple of options:

Code: https://github.com/kasir-barati/graphql-js-ts/tree/main/apps/profile.

Ref