jkettmann / relay-authentication

An example app demonstrating role based authentication and file upload with Relay and GraphQL.
MIT License
152 stars 24 forks source link
authentication graphql login react reactjs registration relay

An example app demonstrating role based authentication and file upload with Relay and GraphQL.

Overview

Users may have a role of type reader, publisher or admin. Readers can access a list of all posts and their own profile. Publishers can additionally create posts and see a list of their own posts. Admin role is not used widely yet.

Authentication

Uses cookie-session and jsonwebtoken to save session data in form of a JSON Web Token in a cookie. This data contains the users id and its role and is made available as rootValue in GraphQL schema.

Server

Client

File Upload

Client

Server

Getting Started

$ npm install

Start the local dev server:

$ npm start

Navigate to http://localhost:3000/ to view the app. Login with email reader@test.com, publisher@test.com or publisher2@test.com and password qwerty.

Commands

test

$ npm run test:server

update-schema

$ npm run update-schema

Credits and Further Information

Based on Essential React starter kit

Authentication

File Upload

Changelog