All Projects → jkettmann → Relay Authentication

jkettmann / Relay Authentication

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

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Relay Authentication

Django Graphql Auth
Django registration and authentication with GraphQL.
Stars: ✭ 200 (+30.72%)
Mutual labels:  graphql, relay, authentication, registration
Php Auth
Authentication for PHP. Simple, lightweight and secure.
Stars: ✭ 713 (+366.01%)
Mutual labels:  authentication, login, registration
Kratos Selfservice Ui React Native
A reference implementation of an app using ORY Kratos for auth (login), sign up (registration), profile settings (update password), MFA/2FA, account recovery (password reset), and more for React Native. This repository is available as an expo template!
Stars: ✭ 24 (-84.31%)
Mutual labels:  authentication, login, registration
Django Rest Registration
User-related REST API based on the awesome Django REST Framework
Stars: ✭ 240 (+56.86%)
Mutual labels:  authentication, login, registration
Appy Backend
A user system to bootstrap your app.
Stars: ✭ 96 (-37.25%)
Mutual labels:  authentication, login, registration
Aura.auth
Provides a unified interface to local and remote authentication systems.
Stars: ✭ 121 (-20.92%)
Mutual labels:  authentication, login
Hackatalk
TalkTalk renewal. Open source chat app built-in expo managed work flow
Stars: ✭ 123 (-19.61%)
Mutual labels:  graphql, relay
Graphql Sequelize Crud
Automatically generate queries and mutations from Sequelize models
Stars: ✭ 129 (-15.69%)
Mutual labels:  graphql, relay
Webauthn
Go package for easy WebAuthn integration
Stars: ✭ 131 (-14.38%)
Mutual labels:  authentication, login
Nextjs Headless Wordpress
🔥 Nextjs Headless WordPress
Stars: ✭ 110 (-28.1%)
Mutual labels:  graphql, authentication
Graphbrainz
A fully-featured GraphQL interface for the MusicBrainz API.
Stars: ✭ 130 (-15.03%)
Mutual labels:  graphql, relay
Frontend
🌏 The front-end application code for https://buildkite.com
Stars: ✭ 132 (-13.73%)
Mutual labels:  graphql, relay
Graphql Directive Auth
GraphQL directive for handling auth
Stars: ✭ 120 (-21.57%)
Mutual labels:  graphql, authentication
Auth
Authenticator via oauth2
Stars: ✭ 118 (-22.88%)
Mutual labels:  authentication, login
Relay Example
[READONLY] 💝 Examples of common Relay patterns used in real-world applications. This repository is automatically exported from https://github.com/adeira/universe via Shipit
Stars: ✭ 126 (-17.65%)
Mutual labels:  graphql, relay
Graphql Live Query
Realtime GraphQL Live Queries with JavaScript
Stars: ✭ 112 (-26.8%)
Mutual labels:  graphql, relay
Next Advanced Apollo Starter
Advanced, but minimalistic Next.js pre-configured starter with focus on DX
Stars: ✭ 131 (-14.38%)
Mutual labels:  graphql, authentication
Relay Rails Blog
A graphql, relay and standard rails application powered demo weblog. We are using Graphql server and relay for our react component data needs.
Stars: ✭ 140 (-8.5%)
Mutual labels:  graphql, relay
Registration Login Spring Xml Maven Jsp Mysql
Registration and Login Example with Spring MVC, Spring Security, Spring Data JPA, XML Configuration, Maven, JSP, and MySQL.
Stars: ✭ 134 (-12.42%)
Mutual labels:  authentication, registration
Absinthe relay
Absinthe support for the Relay framework
Stars: ✭ 143 (-6.54%)
Mutual labels:  graphql, 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

  • /server/graphql/sessionMiddleware.js contains the express middleware used to get session data from the cookie.
  • /graphql/mutation/LoginMutation.js contains the GraphQL mutation type for logging in.
  • /graphql/type/UserType.js in combination with with the getPostsForCreator method in /data/Database.js include an example on how to use rootValue for retrieving restricted data in its posts field. There are other examples in Database.js like the createPost method

Client

  • /client/mutation/LoginMutation.js contains the client side login mutation.
  • /client/pages/user/Login.js utilizes this mutation.
  • /client/pages/user/UserPosts.js displays restricted user data.

File Upload

Client

  • /client/fetchQuery.js adds files to form data to send to GraphQL server.
  • /client/mutation/CreatePostMutation.js sets uploadables, which is used in fetchQuery.
  • /client/pages/user/createPost/CreatePost.js uses this mutation by passing it a File object retrieved from a HTML input element

Server

  • /server/grapqhql/uploadMiddleware.js contains a wrapper around multer middleware, which saves the image to disk and sets its URL as the image field of the GraphQL input. See this comment for more information.
  • /server/graphql/mutation/CreatePostMutation.js uses the image field to save the new post including the URL of the uploaded image.

Getting Started

$ npm install

Start the local dev server:

$ npm start

Navigate to http://localhost:3000/ to view the app. Login with email [email protected], [email protected] or [email protected] 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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].