Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

graphql-auth-demo

Created with CodeSandbox, the article that properly explains this is here

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)
  • mongoose

Althought this example uses mongoose and MongoDb, you can easily set up any other database.

Mutations

mutation {
  register(email:"olivier@gmail.com", password:"compl8353pass"){
    email
    password
  }
}
mutation {
  login(email:"olivier@gmail.com", password:"compl8353pass")
}

Queries

{
  users {
    email
    password
  }
  loggedInUser {
    email
  }
}

To-do

  • Use a different database (relational)
  • Migrate to typescript
  • Add more examples to show how relationships work in GraphQL

Releases

No releases published

Packages

No packages published