{"id":25091654,"url":"https://github.com/itzdiv/auth","last_synced_at":"2025-04-01T20:48:17.774Z","repository":{"id":274852229,"uuid":"924276039","full_name":"itzdiv/auth","owner":"itzdiv","description":"This application uses Express.js with Passport.js for authentication, integrating local and Google OAuth strategies. It securely manages user sessions, encrypts passwords with bcrypt, and stores credentials in a PostgreSQL database.","archived":false,"fork":false,"pushed_at":"2025-01-29T18:15:23.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T13:41:30.822Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"EJS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itzdiv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-29T18:08:46.000Z","updated_at":"2025-01-29T18:18:36.000Z","dependencies_parsed_at":"2025-01-29T19:24:57.149Z","dependency_job_id":"b434e711-2023-4ce1-a153-1b05a9392652","html_url":"https://github.com/itzdiv/auth","commit_stats":null,"previous_names":["itzdiv/auth"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzdiv%2Fauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzdiv%2Fauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzdiv%2Fauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzdiv%2Fauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itzdiv","download_url":"https://codeload.github.com/itzdiv/auth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709915,"owners_count":20821298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-07T13:37:22.536Z","updated_at":"2025-04-01T20:48:17.756Z","avatar_url":"https://github.com/itzdiv.png","language":"EJS","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n   \u003ch2\u003eAuthentication System Overview\u003c/h2\u003e\n    \u003cp\u003eThis Express.js application implements user authentication using Passport.js, bcrypt for password hashing, PostgreSQL as the database, and Google OAuth for third-party authentication.\u003c/p\u003e\n    \n  \u003ch2\u003eKey Features:\u003c/h2\u003e\n    \u003cul\u003e\n        \u003cli\u003e\u003cstrong\u003eSession Management:\u003c/strong\u003e Uses \u003ccode\u003eexpress-session\u003c/code\u003e to handle user sessions securely.\u003c/li\u003e\n        \u003cli\u003e\u003cstrong\u003eLocal Authentication:\u003c/strong\u003e Implements username-password authentication using Passport Local Strategy and bcrypt for secure password storage.\u003c/li\u003e\n        \u003cli\u003e\u003cstrong\u003eGoogle Authentication:\u003c/strong\u003e Enables users to log in via Google OAuth2.\u003c/li\u003e\n        \u003cli\u003e\u003cstrong\u003eDatabase Integration:\u003c/strong\u003e Stores user credentials in PostgreSQL, ensuring persistent authentication.\u003c/li\u003e\n    \u003c/ul\u003e\n    \n  \u003ch2\u003eAuthentication Flow\u003c/h2\u003e\n    \u003ch3\u003eRegistration\u003c/h3\u003e\n    \u003cp\u003eWhen a user registers, the password is hashed using bcrypt and stored in the database.\u003c/p\u003e\n    \u003cpre\u003e\n        INSERT INTO users (email, password) VALUES ($1, $2)\n    \u003c/pre\u003e\n    \n  \u003ch3\u003eLogin\u003c/h3\u003e\n    \u003cp\u003eDuring login, the provided password is compared with the stored hashed password using bcrypt.\u003c/p\u003e\n    \n   \u003ch3\u003eGoogle OAuth Login\u003c/h3\u003e\n    \u003cp\u003eGoogle authentication is handled via Passport's Google OAuth2 strategy. If the user is new, their email is stored in the database.\u003c/p\u003e\n    \n  \u003ch2\u003eSession Handling\u003c/h2\u003e\n    \u003cp\u003eUsers' authentication states are maintained using Passport's serialization and deserialization methods.\u003c/p\u003e\n    \n  \u003ch2\u003eRoutes Overview\u003c/h2\u003e\n    \u003cul\u003e\n        \u003cli\u003e\u003ccode\u003eGET /\u003c/code\u003e: Home page\u003c/li\u003e\n        \u003cli\u003e\u003ccode\u003eGET /login\u003c/code\u003e: Login page\u003c/li\u003e\n        \u003cli\u003e\u003ccode\u003eGET /register\u003c/code\u003e: Registration page\u003c/li\u003e\n        \u003cli\u003e\u003ccode\u003ePOST /register\u003c/code\u003e: Handles user registration\u003c/li\u003e\n        \u003cli\u003e\u003ccode\u003ePOST /login\u003c/code\u003e: Handles user login\u003c/li\u003e\n        \u003cli\u003e\u003ccode\u003eGET /secrets\u003c/code\u003e: Protected route requiring authentication\u003c/li\u003e\n        \u003cli\u003e\u003ccode\u003eGET /logout\u003c/code\u003e: Logs out the user\u003c/li\u003e\n        \u003cli\u003e\u003ccode\u003eGET /auth/google\u003c/code\u003e: Redirects users to Google OAuth\u003c/li\u003e\n    \u003c/ul\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitzdiv%2Fauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitzdiv%2Fauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitzdiv%2Fauth/lists"}