Skip to content

Latest commit

 

History

History

email-password

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

email-password

Add email and password login to your Graphcool Project 🎁

Getting Started

1. Add the template to your Graphcool service

graphcool add-template graphcool/templates/auth/email-password

2. Uncomment lines in graphcool.yml and types.graphql

The add-template command is performing three major steps:

  1. Download the source files from the src directory and put them into your service's src directory (into a subdirectory called email-password).
  2. Download the contents from graphcool.yml and append them as comments to your service's graphcool.yml.
  3. Download the contents from types.graphql and append them as comments to your service's types.graphql.

In order for the changes to take effect, you need to manually uncomment all the lines that have been added by the add-template command.

3. Deploy the service

Finally, you need to install the node dependencies and apply all the changes you just made by deploying the service:

npm install
graphcool deploy

Test the Code

Go to the Graphcool Playground:

graphcool playground

Run this mutation to create a user:

mutation {
  signupUser(email: "__EMAIL__", password: "__PASSWORD__") {
    id
    token
  }
}

and this to authenticate as that user:

mutation {
  authenticateUser(email: "__EMAIL__", password: "__PASSWORD__") {
    token
  }
}