Company
Date Published
Author
Jonas Helfer
Word count
1532
Language
English
Hacker News points
None

Summary

The text discusses authentication in GraphQL, a query language for APIs. It explains two main options for implementing authentication: doing it in the web server or handling it within the GraphQL schema itself. The first option has advantages of using standard auth packages and flexibility but requires an additional authentication endpoint. In contrast, the second approach involves generating session tokens on the client-side and passing them with each request, which can lead to repetition and complexity. The author concludes that handling authentication in the web server is generally more suitable due to its generality and flexibility. However, there are cases where GraphQL-based authentication might be necessary, and the text provides a basic example of how it could be implemented.