Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Authentication and Authorization workflow #14

Closed
wants to merge 54 commits into from

Conversation

Eprince-hub
Copy link
Member

@Eprince-hub Eprince-hub commented Oct 24, 2024

Add the authentication and authorization workflow to the GraphQL example so that users can register, login, and logout. This workflow also includes the protection of some pages and user-generated content by preventing unauthenticated users from accessing some parts of the application

TODOs

  • create new migrations for the auth workflow
    • users table
    • notes table
    • sessions table
  • create database query functions
    • database query function without session token
      • database/users.ts
        • getUserInsecure
        • getUserWithPasswordHashInsecure
        • createUserInsecure
      • database/sessions.ts
        • createSessionInsecure
    • secured database query functions with session token
      • database/users.ts
        • getUser
      • database/notes.ts
        • getNotes
        • getNote
        • createNote
      • database/sessions.ts
        • getValidSession
        • deleteSession
  • 🤔 create onboarding page
    • add link to register page
    • add link to login page
  • create registration workflow
    • add a registration form
      • send HTTP request to the register API route
    • create register API route
      • create sessions
  • create login workflow
    • add a login form
      • send HTTP request to the login API route
    • create login API route
      • create sessions
  • prevent authenticated users from accessing the register page
  • prevent authenticated users from accessing the login page
  • refactor cookie options
    • util/cookies.ts
      • export secureCookieOptions object
  • create a logout workflow
    • add a logout form
      • send HTTP request to the logout API route
    • create logout API route
      • delete sessions
  • prevent unauthenticated users from accessing the guests page
    • return user to guests page after login using returnTo query parameter
  • React Native authorization
    • Notes (user generated content)
      • create Notes page
        • send HTTP request to the notes API route
      • create notes API route
        • authenticated user can create notes
        • authenticated user can query notes
      • create Note page
        • send HTTP request to the note API route
      • create note API route
        • authenticated user can query note
    • authorization on note pages
      • only show notes where current user is note owner on notes page
      • "Access Denied" on the single note page
    • add notes navigation link to bottom navigation

@Eprince-hub Eprince-hub self-assigned this Oct 24, 2024
@Eprince-hub Eprince-hub changed the base branch from main to add-postgres October 24, 2024 13:20
ProchaLu and others added 7 commits October 24, 2024 15:54
* Add edit guest UI and API

* Fix API order

* Remove file

* Fix API route
* Improve styling

* Update styling

* Fix lint errors

* Update colors and styling for better UI consistency

* Add snack bar, add placeholder img

* Fix ESLint error, refactor snackbar

* Fix ESLint with new dependency array

* Remove set state in useeffect

* Remove commented out code

* Remove input validation, change button style

* Fix ESLint error

* Add ios chevron to single guest modal

* Refactor code to remove unused imports and update styling

* Update lockfile

* Remove Snackbar component

* Remove iOS back button

* Change folder structure

* Fix api route

* Refactor file path for newGuest component

* Change from id to guestId

* Simplify styling

* Refactor guest form styling and functionality
Base automatically changed from add-postgres to next October 24, 2024 22:17
An error occurred while trying to automatically change base from add-postgres to next October 24, 2024 22:17
@ProchaLu
Copy link
Member

We decided not to do auth in the first Expo lecture, but rather as a PR in the "auth-restricting-access" lecture

Superseded by

@ProchaLu ProchaLu closed this Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants