{"id":28762822,"url":"https://github.com/learnwithfair/one-tap-signin","last_synced_at":"2026-02-01T23:04:49.729Z","repository":{"id":293019630,"uuid":"982543952","full_name":"learnwithfair/one-tap-signin","owner":"learnwithfair","description":"Google One Tap Sign-In and Sign in with google account","archived":false,"fork":false,"pushed_at":"2025-05-13T09:01:20.000Z","size":2941,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-17T08:47:20.032Z","etag":null,"topics":["google","google-auth","google-authentication","learnwithfair","rahatul-rabbi","rahatulrabbi"],"latest_commit_sha":null,"homepage":"https://learnwithfair.github.io/one-tap-signin/","language":"HTML","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/learnwithfair.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,"zenodo":null}},"created_at":"2025-05-13T03:44:42.000Z","updated_at":"2025-05-15T15:07:59.000Z","dependencies_parsed_at":"2025-05-13T09:43:18.179Z","dependency_job_id":"a15f72f9-5db7-41c1-a2ea-5868fb4e1881","html_url":"https://github.com/learnwithfair/one-tap-signin","commit_stats":null,"previous_names":["learnwithfair/one-tap-signin"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/learnwithfair/one-tap-signin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learnwithfair%2Fone-tap-signin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learnwithfair%2Fone-tap-signin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learnwithfair%2Fone-tap-signin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learnwithfair%2Fone-tap-signin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/learnwithfair","download_url":"https://codeload.github.com/learnwithfair/one-tap-signin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/learnwithfair%2Fone-tap-signin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28993800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T22:01:47.507Z","status":"ssl_error","status_checked_at":"2026-02-01T21:58:37.335Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["google","google-auth","google-authentication","learnwithfair","rahatul-rabbi","rahatulrabbi"],"created_at":"2025-06-17T08:40:56.825Z","updated_at":"2026-02-01T23:04:49.713Z","avatar_url":"https://github.com/learnwithfair.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GOOGLE SIGN-IN INTEGRATION\n\n[![Youtube][youtube-shield]][youtube-url]\n[![Facebook][facebook-shield]][facebook-url]\n[![Instagram][instagram-shield]][instagram-url]\n[![LinkedIn][linkedin-shield]][linkedin-url]\n\nThanks for visiting my GitHub account!\n\nA clean and modern e-commerce HTML template integrated with **Google One Tap Sign-In** and **Sign-In with Google Button**.\n\n\u003e This project showcases how to integrate **dual Google authentication** using the latest [Google Identity Services](https://developers.google.com/identity/gsi/web) with full login detection, logout, and UI visibility control.\n\n---\n\n## ✨ Features\n\n- ✅ Google One Tap Sign-In (floating modal)\n- ✅ Google Sign-In button (visible UI)\n- ✅ Shared login logic using Google Identity Services\n- ✅ LocalStorage-based login persistence\n- ✅ Auto-hide login UI after successful login\n- ✅ Logout button to reset state\n- ✅ Fully responsive using Bootstrap 5.3\n\n---\n\n## ⚙️ Technologies Used\n\n- ✅ HTML5, CSS3\n- ✅ Bootstrap 5.3\n- ✅ Vanilla JavaScript\n- ✅ Google Identity Services SDK\n\n---\n\n## 🔐 How It Works\n\n### ✅ 1. Google One Tap Sign-In\n\n- Injected dynamically only when user is **not logged in**\n- Uses `google.accounts.id.prompt()` to show the floating modal\n- Automatically handles silent login for returning users\n\n### ✅ 2. Sign In With Google Button\n\n- Uses `google.accounts.id.renderButton()` to render a visible Google sign-in button\n- When clicked, it authenticates the user and calls the same `handleCredentialResponse()` callback as One Tap\n\n### ✅ 3. After Login\n\n- Stores user info (name, email, picture) in `localStorage`\n- Displays a professional top bar with user info and a logout button\n- Hides One Tap modal and button\n- Prevents Google from auto-triggering One Tap again with `cancel()` and `disableAutoSelect()`\n\n---\n\n## 🚀 How to Use\n\n### ✅ 1. Clone or Download\n\n```bash\ngit clone https://github.com/yourusername/learn-with-fair-login.git\n```\n\nOr just download the `index.html` file and open it in your browser.\n\n---\n\n### ✅ 2. Open in Browser\n\nSimply open the `index.html` file in any modern web browser.\n\n\u003e **⚠️ Note:**  \n\u003e Google One Tap **only works on**:\n\u003e\n\u003e - `http://localhost` — for local development\n\u003e - An **HTTPS-secured domain** — for live/production use\n\n---\n\n### ✅ 3. Replace Client ID (Optional but Recommended)\n\nTo use your own Google Sign-In credentials, follow these steps:\n\n#### 🔧 Create Your Google OAuth 2.0 Client ID\n\n1. Go to the [Google Cloud Console](https://console.cloud.google.com/)\n2. Create a new project or select an existing one\n3. Navigate to:  \n   **APIs \u0026 Services → Credentials**\n4. Click **Create Credentials → OAuth client ID**\n5. Choose:\n\n   - **Application type**: `Web Application`\n   - **Authorized JavaScript origins**:\n     - `http://localhost`\n     - Or your custom HTTPS domain\n   - **Authorized redirect URIs**: _(leave blank)_\n\n6. Click **Create**, and copy your new **Client ID**\n\n---\n\n#### 🧩 Replace the Client ID in the Code\n\nUpdate both places in your code where `client_id` is set:\n\n```js\nconst clientId = \"YOUR_OWN_CLIENT_ID\";\n\ngoogle.accounts.id.initialize({\n  client_id: clientId,\n  callback: handleCredentialResponse,\n  ...\n});\n\ngoogle.accounts.id.renderButton(\n  document.getElementById(\"google-button\"),\n  {\n    client_id: clientId,\n    ...\n  }\n);\n```\n\nThis ensures both One Tap and the Sign-In button use your own credentials.\n\n---\n\n## 🧪 Functional Overview\n\n| Feature                    | Description                                |\n| -------------------------- | ------------------------------------------ |\n| One Tap Sign-In            | Appears as floating prompt (if logged out) |\n| Sign-In with Google Button | Renders below navbar for manual login      |\n| Unified Auth Callback      | Both use `handleCredentialResponse()`      |\n| Persistent Session         | Stores info in `localStorage`              |\n| Logout                     | Clears session, shows login again          |\n| Responsive                 | Yes – works on mobile, tablet, desktop     |\n\n## Follow Me\n\n[\u003cimg src='https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/github.svg' alt='github' height='40'\u003e](https://github.com/learnwithfair) [\u003cimg src='https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/facebook.svg' alt='facebook' height='40'\u003e](https://www.facebook.com/learnwithfair/) [\u003cimg src='https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/instagram.svg' alt='instagram' height='40'\u003e](https://www.instagram.com/learnwithfair/) [\u003cimg src='https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/twitter.svg' alt='twitter' height='40'\u003e](https://www.twiter.com/learnwithfair/) [\u003cimg src='https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/youtube.svg' alt='YouTube' height='40'\u003e](https://www.youtube.com/@learnwithfair)\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\n[youtube-shield]: https://img.shields.io/badge/-Youtube-black.svg?style=flat-square\u0026logo=youtube\u0026color=555\u0026logoColor=white\n[youtube-url]: https://youtube.com/@learnwithfair\n[facebook-shield]: https://img.shields.io/badge/-Facebook-black.svg?style=flat-square\u0026logo=facebook\u0026color=555\u0026logoColor=white\n[facebook-url]: https://facebook.com/learnwithfair\n[instagram-shield]: https://img.shields.io/badge/-Instagram-black.svg?style=flat-square\u0026logo=instagram\u0026color=555\u0026logoColor=white\n[instagram-url]: https://instagram.com/learnwithfair\n[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square\u0026logo=linkedin\u0026colorB=555\n[linkedin-url]: https://www.linkedin.com/in/rahatul-rabbi/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flearnwithfair%2Fone-tap-signin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flearnwithfair%2Fone-tap-signin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flearnwithfair%2Fone-tap-signin/lists"}