Skip to content

Files

Latest commit

9ae150a · Dec 21, 2017

History

History
This branch is up to date with graphcool-examples/react-graphql:master.

authentication-with-email-and-apollo

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Dec 21, 2017
Dec 21, 2017
Dec 21, 2017
Dec 21, 2017
Dec 21, 2017
Dec 21, 2017
Dec 21, 2017
Dec 21, 2017

Email Authentication Example (with React & Apollo)

This is an authentication example based on the simple Email & Password Authentication template.

Getting Started

1. Download the example

curl https://codeload.github.com/graphcool-examples/react-graphql/tar.gz/master | tar -xz --strip=1 react-graphql-master/authentication-with-email-and-apollo
cd authentication-with-email-and-apollo/server

2. Create your Graphcool service

# Install latest version of the Graphcool CLI
npm install -g graphcool

# Install dependencies and deploy service
yarn install
graphcool deploy

When prompted which cluster you want to deploy to, choose any of the Shared Clusters options (shared-eu-west-1, shared-ap-northeast-1 or shared-us-west-2).

Note: The service's schema is created based on the type definitions in ./server/types.graphql.

3. Connect the app with your GraphQL API

Paste the Simple API endpoint from the previous step to ./src/index.js as the uri argument in the createHttpLink call:

// replace `__SIMPLE_API_ENDPOINT__` with the endpoint from the previous step
const httpLink = new createHttpLinkHttpLink({ uri: '__SIMPLE_API_ENDPOINT__' })

Note: You can get access to your endpoint using the graphcool info command.

4. Install dependencies & run locally

Navigate back into the root directory of the project, install the dependencies and run the app:

cd ..
yarn install
yarn start 

You can now use the app at http://localhost:3000.

Next steps

Help & Community Slack Status

Say hello in our Slack or visit the Graphcool Forum if you run into issues or have questions. We love talking to you!