hasura / ask-me-anything

This is a repository for the AMA live video sessions.
3 stars 0 forks source link

Question: How to correctly implement Oauth to Hasura? #27

Open Dishock opened 3 years ago

Dishock commented 3 years ago

I originally wanted to apply this to my currently used Hasura DB (hosted on Heroku), but decided to test it out on a fresh project first. I was unable to both deploy locally and deploy on Heroku. I'm a total rookie considering the backend, but I don't want to use Firebase/Auth0, as this solution seems perfect for most use cases. If I could accomplish this, I could get happily back to Nuxt and VueJS and not worry about the database stuff for a while :)

PassportJS for GraphQL

Both of my journeys went south, I bring local deploy as an example:

Deploy locally

  1. Clone the repo (success) git clone https://github.com/hasura/graphql-engine

  2. Change directory (success) cd graphql-engine/community/boilerplates/auth-webhooks/passport-js

  3. Install NPM dependencies (failed - Bcrypt gave 404) npm install

    
    #Commands I used to perhaps succeed (introduced vulnerabilities which I haven't yet fixed)
    npm cache clean -f
    npm install bcrypt --save


4. Set DATABASE_URL env (failed - Unsure where I can find the .env file)
export DATABASE_URL=postgres://<username>:<password>@<host>:<port>/<database_name>

5. Apply migrations. Note: this step creates a "users" table in the database (failed, don't know what knex is or how to use it)
knex migrate:latest

6. Then simply start your app (failed - Didn't even bother to try at this point)
npm start

----------------------------------------------------

I believe users are a fundamental and one of the toughest part to do right  The documentation flies waay over entry level guys like me. So please, help us out or Auth0 will consume us with all their available tutorials..
Dishock commented 3 years ago

In retrospect I might have successfully done it, I just had different expectations of the end result. I hoped to have a user registration/login flow usable through GraphQL, which would still be a fantastic topic to touch imo :)

Adron commented 3 years ago

Good question @Dishock, in the coming month I'm hoping to have multiple sessions on this particular topic as related to Hasura. When I get the date set for when I'll be covering this material I'll add a comment here so you'll get notified! 👍🏻