Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lailo/pwlessql
Passwordless auth using GraphQL API and Prisma.io
https://github.com/lailo/pwlessql
api authentication email graphql graphql-server passwordless passwordless-authentication prisma
Last synced: 4 days ago
JSON representation
Passwordless auth using GraphQL API and Prisma.io
- Host: GitHub
- URL: https://github.com/lailo/pwlessql
- Owner: lailo
- License: mit
- Created: 2019-05-11T15:22:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-16T15:17:31.000Z (over 5 years ago)
- Last Synced: 2023-10-26T10:24:29.510Z (about 1 year ago)
- Topics: api, authentication, email, graphql, graphql-server, passwordless, passwordless-authentication, prisma
- Language: JavaScript
- Homepage:
- Size: 88.9 KB
- Stars: 9
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Passwordless Auth with GraphQL and Prisma
Authenticate Users without the need for a password, forgot-password and reset-password.
Less code, less emails and less users leaving because of forgoten passwords.
xw## Setup Development
1. Copy `.env.template` to ".env"
2. Add your enpoint url to `prisma/primsa.yml`
3. run `npm install`
4. run `npm run db` to setup the the database, generate client and run seed
5. start your server with "npm run dev"
6. Open GraphQL Playground on `http://localhost:4000`## Setup Production
1. just run `npm start`
## Setup eMail Service
NodeMailer is in use for now with `ethereal.email`.
If you want something else, just edit the `emails/sendEmail.js` and add your own settings / client## How does it work?
### Signup
1. Get `name` from email from the part before the `@` symbol
2. Generate `slug` from `name`
3. Create User
4. Continue with **Login**### Login
1. Create an `Auth` entry with `token' and the`email`
1.1. with UUID token
1.2. with email the messages it was sent to
2. Generate a security to compare with the email (no fake emails)
3. Click on link with `email` and `token`
4. Check if
4.1. Auth entry with `token` exists
4.2. `email` is correct
4.3. the `createdAt` is not more then 1h ago
5. Generate JWT with `userId`
6. delete Auth entry