Dev/auth (User Login) #33 #92

Merged
2nPlusOne merged 18 commits from dev/auth into main 2023-11-16 17:44:03 +00:00
2nPlusOne commented 2023-11-12 06:10:25 +00:00 (Migrated from github.com)

User Login with NextAuth

As a visitor, I want to see an option on the navbar to log in with my Google account so that I can access site features that I am authenticated for.

https://github.com/rit-sse/WebsiteTheSSEquel/assets/39078738/a93e0b88-bb69-4612-8f75-3350b800dd00

Definition of Done

  • Acceptance criteria defined
  • Solution tasks specified
  • Feature branch created
  • Unit tests written (on API code only for now)
  • Solution passes full suite of unit tests
  • Design documents updated if needed
  • Pull request created
  • Code is reviewed
  • Code is merged to main branch
  • Tests pass on CI
  • Deployed to staging environment
  • Acceptance criteria is met

Acceptance Criteria

  • Given I am logged out, when I look at the navbar, I should see a login button at the right of the navbar.
  • Given I am logged in, when I look at the navbar, I should see at logout button at the top right of the navbar.
  • Given I am not logged into my rit google account in the browser session, when I click the login button, I should be prompted to login to my rit google account.
  • Given I am already logged into my RIT google account, when I click the login button, I should be logged in automatically.
  • Given that I am logged into the website, when I click logout, the button should change to say "logout", and I should lose my login session credentials.

Solution Tasks

  • Create a google client ID and secret, and add it to the local .env file
  • Add the next-auth dependency
  • Create the authentication route
  • Create the auth options, setting up the google provider and prisma adapter.
  • Adjust prisma schema to match the schema expected by the prisma adapter for next-auth.
  • Add hd: "g.rit.edu" as an authorization parameter to the google provider config, restricting the account selection to those with the g.rit.edu domain.
  • Create login and logout buttons, and hook up their on click events to the next-auth api routes.
# User Login with NextAuth As a visitor, I want to see an option on the navbar to log in with my Google account so that I can access site features that I am authenticated for. https://github.com/rit-sse/WebsiteTheSSEquel/assets/39078738/a93e0b88-bb69-4612-8f75-3350b800dd00 ## Definition of Done - [x] Acceptance criteria defined - [x] Solution tasks specified - [x] Feature branch created - [ ] ~~Unit tests written (on API code only for now)~~ - [ ] ~~Solution passes full suite of unit tests~~ - [ ] Design documents updated if needed - [ ] Pull request created - [ ] Code is reviewed - [ ] Code is merged to `main` branch - [ ] ~~Tests pass on CI~~ - [ ] ~~Deployed to staging environment~~ - [x] Acceptance criteria is met ## Acceptance Criteria - [x] Given I am **logged out**, when I look at the navbar, I should see a login button at the right of the navbar. - [x] Given I am **logged in**, when I look at the navbar, I should see at logout button at the top right of the navbar. - [x] Given I am not logged into my rit google account in the browser session, when I click the login button, I should be prompted to login to my rit google account. - [x] Given I am already logged into my RIT google account, when I click the login button, I should be logged in automatically. - [x] Given that I am logged into the website, when I click logout, the button should change to say "logout", and I should lose my login session credentials. ## Solution Tasks - [x] Create a google client ID and secret, and add it to the local .env file - [x] Add the next-auth dependency - [x] Create the authentication route - [x] Create the auth options, setting up the google provider and prisma adapter. - [x] Adjust prisma schema to match the schema expected by the prisma adapter for next-auth. - [x] Add hd: "g.rit.edu" as an authorization parameter to the google provider config, restricting the account selection to those with the g.rit.edu domain. - [x] Create login and logout buttons, and hook up their on click events to the next-auth api routes.
raynardmiot (Migrated from github.com) reviewed 2023-11-12 06:10:25 +00:00
baillie28 (Migrated from github.com) approved these changes 2023-11-13 19:04:09 +00:00
baillie28 (Migrated from github.com) left a comment

Front-end changes look good from my limited front-end perspective. Doesn't look like there's any necessary changes.

Front-end changes look good from my limited front-end perspective. Doesn't look like there's any necessary changes.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
SSE/WebsiteTheSSEquel!92
No description provided.