Giter Club home page Giter Club logo

Comments (3)

clifinger avatar clifinger commented on May 15, 2024

The GraphQL specification doesn’t tell you how to do authentication or authorization. It can be a bit confusing to developers who are new to GraphQL. I don’t claim to have all the answers, so if you have a different idea or a different opinion, feel free to share that in the comments so we can all learn together!

  1. Let the web server (e.g. express or nginx) take care of authentication or a micro service like auth server.
  2. Handle authentication in GraphQL itself.

I am fan of SRP (single responsibility principle), GraphQL for the query, the endpoint for consuming the data and the authentication server for what you know ... Like major compagnies with Oauth ...

In my point I don't think it's a good choice to handle it into the graphql endpoints as it is a single endpoint...what you can do if you want to make the full endpoint private?

from canduma.

PabloSzx avatar PabloSzx commented on May 15, 2024

In the Node.js ecosystem there is good tooling around authorization inside the GraphQL schema itself, to give some examples:

I don't have the experience in Rust to give some examples in how I could do it here, but it's specially convenient for the client side to use the same tooling used for the GraphQL schema (Apollo / Relay / urql /gqless, etc...) while doing the authentication process, simply using mutations, instead of hacking around extra logic just for the current_user / login / sign_up / logout.

from canduma.

PabloSzx avatar PabloSzx commented on May 15, 2024

And it raises another question, how can I expose some parts of the GraphQL Schema of this template to be open without authorization?

from canduma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.