Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olivierjm/graphql-auth-demo
demo on how to handle authentication in GraphQL
https://github.com/olivierjm/graphql-auth-demo
apollo-server authentication codesandbox graphql graphql-server server
Last synced: 4 months ago
JSON representation
demo on how to handle authentication in GraphQL
- Host: GitHub
- URL: https://github.com/olivierjm/graphql-auth-demo
- Owner: OlivierJM
- Created: 2019-05-27T06:52:16.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-03T02:30:03.000Z (about 2 years ago)
- Last Synced: 2023-03-07T22:03:59.135Z (almost 2 years ago)
- Topics: apollo-server, authentication, codesandbox, graphql, graphql-server, server
- Language: JavaScript
- Homepage: https://n6bpe.sse.codesandbox.io/
- Size: 365 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# graphql-auth-demo
Created with CodeSandbox, the article that properly explains this is [here](https://medium.com/developer-circles-lusaka/https-medium-com-olivierjm-auth-graphql-7f92e8120027)
> This was created to demonstrate authentication in GraphQL.
- create a user
- authenticate the user
- generate and validate the token**Used**
- apollo-server v2
- jsonwebtoken
- bcrypt
- pick(from lodash)
- mongooseAlthought this example uses mongoose and MongoDb, you can easily set up any other database.
**Mutations**
```graphql
mutation {
register(email:"[email protected]", password:"compl8353pass"){
password
}
}
``````graphql
mutation {
login(email:"[email protected]", password:"compl8353pass")
}
```**Queries**
```graphql
{
users {
password
}
loggedInUser {
}
}```
**To-do**
- Use a different database (relational)
- Migrate to typescript
- Add more examples to show how relationships work in GraphQL