Giter Club home page Giter Club logo

hasura-simple-auth's Introduction

hasura-simple-auth

Simple authentication provider for hasura based on the doc example in python/flask but reimplemented with rust/actix.

Hasura expectations

Models

Expect a users table like this :

CREATE TABLE users (
    id serial NOT NULL,
    name text NOT NULL,
    password text NOT NULL,
    email text NOT NULL,
    PRIMARY KEY (id),
    UNIQUE (name),
    UNIQUE (email)
    );

Actions

In actions.yaml :

actions:
- name: login
  definition:
    kind: synchronous
    handler: http://127.0.0.1:3000/login
    forward_client_headers: true
  permissions:
  - role: anonymous
- name: signup
  definition:
    kind: synchronous
    handler: http://localhost:3000/signup
    forward_client_headers: true
custom_types:
  enums: []
  input_objects:
  objects:
  - name: LoginToken
  - name: SignupResponse
  scalars: []

In actions.graphql :

type Mutation {
  login (
    name: String!
    password: String!
  ): LoginToken
}   

type LoginToken {
  error : Boolean!
  token : String!
}

type Mutation {
  signup (
    name: String!
    email: String!
    password: String!
  ): SignupResponse
} 

type SignupResponse {
  unknown_error : Boolean
  name_error : Boolean
  email_error : Boolean
  userid : Int
}

Environment variables

In .env (for example) :

# Secret to hash password
ARGON2_SECRET="very secret argon2"
# Hasura admin Secret
HASURA_GRAPHQL_ADMIN_SECRET="hasura admin secret - keep in sync with hasura deployment"
# JWT key encryption
HASURA_GRAPHQL_JWT_SECRET_KEY="jwt generation symmetric key - keep in sync with hasura deployment"
# Graphql endpoint
HASURA_GRAPHQL_ENDPOINT="http://localhost:8080/v1/graphql"

hasura-simple-auth's People

Contributors

kreako avatar

Stargazers

Emmanuel Salomon avatar

Watchers

 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.