Code Monkey home page Code Monkey logo

authway's Introduction

Authway

Version License: MIT

Authentication server for Hasura that does the job ๐Ÿ’ช

Install

You need Node.js installed on your machine.

$ git clone https://github.com/pnfcre/authway.git
$ cd authway

Install the required dependencies.

$ npm install

Usage

Start your Hasura instance with the following environment variables set:

HASURA_GRAPHQL_ADMIN_SECRET: a_very_secure_admin_secret_goes_here
HASURA_GRAPHQL_JWT_SECRET: '{"type": "HS256", "key": "a_very_secure_jwt_secret_goes_here"}'

Install the Hasura CLI to run migrations:

$ npm i -g hasura-cli
$ hasura migrate apply --endpoint "<endpoint>" --admin-secret "<admin-secret>"

Copy the .env.example file to .env:

$ cp .env.example .env && $EDITOR $_

Edit the file and start the server ๐Ÿš€

$ npm i -g pm2
$ pm2 start npm --name "authway" -- start

API Documentation

All fields are required.

POST /register

Expects the following fields in the JSON body: email, password and username.

  • email: Valid email address.
  • password: String between 6-128 characters in length.
  • username: Alpha-numeric string between 2-32 characters in length.

Returns 204 No Content if account is successfully created.

POST /activate

Expects the following field in the JSON body: secret_token.

  • secret_token: Valid UUIDv4 string.

Returns 204 No Content if account is successfully activated.

POST /login

Expects the following fields in the JSON body: email, password and username.

  • email: Valid email address.
  • password: String between 6-128 characters in length.

Returns the following fields on successful login: refresh_token and jwt_token.

POST /refresh

Expects the following field in the JSON body: refresh_token.

  • refresh_token: Valid UUIDv4 string.

Returns the following fields if successful: refresh_token and jwt_token.

POST /forgot

Expects the following fields in the JSON body: secret_token and password.

  • secret_token: Valid UUIDv4 string.
  • password: String between 6-128 characters in length.

Returns 204 No Content if password is successfully changed.

Author

๐Ÿ‘ค Hampus Kraft

๐Ÿค Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a โญ๏ธ if this project helped you!

๐Ÿ“ License

Copyright ยฉ 2020 Hampus Kraft.

This project is MIT licensed.


This project is inspired by Hasura Backend Plus.

authway's People

Contributors

hampuskraft avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.