{"id":16132868,"url":"https://github.com/dashroshan/mern-google-auth","last_synced_at":"2025-04-06T15:16:10.381Z","repository":{"id":115286780,"uuid":"531823672","full_name":"dashroshan/mern-google-auth","owner":"dashroshan","description":"🔐 Boilerplate code to implement google authentication with MERN stack","archived":false,"fork":false,"pushed_at":"2022-09-21T16:24:23.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T21:17:31.771Z","etag":null,"topics":["authorization","google-authentication","mern"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/dashroshan.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":"2022-09-02T07:22:17.000Z","updated_at":"2022-09-21T16:34:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"a602db2c-5c06-4ff9-b5f9-319a5f03c4f2","html_url":"https://github.com/dashroshan/mern-google-auth","commit_stats":null,"previous_names":["dashroshan/mern-google-auth"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashroshan%2Fmern-google-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashroshan%2Fmern-google-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashroshan%2Fmern-google-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashroshan%2Fmern-google-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dashroshan","download_url":"https://codeload.github.com/dashroshan/mern-google-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247500476,"owners_count":20948880,"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":["authorization","google-authentication","mern"],"created_at":"2024-10-09T22:34:57.378Z","updated_at":"2025-04-06T15:16:10.357Z","avatar_url":"https://github.com/dashroshan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Install dependencies\n\n```\nnpm install\n```\n\nconfig.env file inside config directory\n\n```\nPORT = 4000\nMONGO_URI = mongodb://localhost:27017/google\nGOOGLE_CLIENT_ID = xxxxx.apps.googleusercontent.com\nGOOGLE_CLIENT_SECRET = xxxxxxxxxxxxxxxxxxxxxxxxxxxx\nCALLBACK_URL = /auth/google/callback\n```\n\nexample react index.js file (running on port 3000)\n```\nimport './App.css';\nimport axios from \"axios\";\n\nfunction App() {\n    const checkLogin = async () =\u003e {\n        try {\n            const res = await axios.get(\"http://localhost:4000/auth/check\", { withCredentials: true });\n            console.log(JSON.stringify(res.data));\n        }\n        catch (err) {\n            console.log(err);\n        }\n    }\n\n    const logOut = async () =\u003e {\n        try {\n            const res = await axios.get(\"http://localhost:4000/auth/logout\", { withCredentials: true });\n            console.log(JSON.stringify(res.data));\n        }\n        catch (err) {\n            console.log(err);\n        }\n    }\n\n    return (\n        \u003cdiv className=\"App\"\u003e\n            \u003cheader className=\"App-header\"\u003e\n                \u003ca href=\"http://localhost:4000/auth/login\"\u003eLogin\u003c/a\u003e\n                \u003cbutton onClick={logOut}\u003eLogout\u003c/button\u003e\n                \u003cbutton onClick={checkLogin}\u003eCheck\u003c/button\u003e\n            \u003c/header\u003e\n        \u003c/div\u003e\n    );\n}\n\nexport default App;\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashroshan%2Fmern-google-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdashroshan%2Fmern-google-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashroshan%2Fmern-google-auth/lists"}