{"id":18663165,"url":"https://github.com/damiansire/google-sheet-auth-javascript-examples-google-api","last_synced_at":"2026-04-30T03:35:30.763Z","repository":{"id":243568652,"uuid":"812778276","full_name":"damiansire/google-sheet-auth-javascript-examples-google-api","owner":"damiansire","description":"This repository provides examples and guidance on how to authenticate with Google APIs and interact with Google Sheets using JavaScript/Node.js. Includes demos for reading, writing, and updating spreadsheet data with Google's official `googleapis` library.","archived":false,"fork":false,"pushed_at":"2024-06-09T21:12:45.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-26T08:04:06.803Z","etag":null,"topics":["auth","authentication","google-sheets","google-sheets-api","google-sheets-api-v4","javascript","nodejs"],"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/damiansire.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":"2024-06-09T21:10:18.000Z","updated_at":"2024-06-09T21:12:48.000Z","dependencies_parsed_at":"2024-06-09T22:40:10.129Z","dependency_job_id":null,"html_url":"https://github.com/damiansire/google-sheet-auth-javascript-examples-google-api","commit_stats":null,"previous_names":["damiansire/google-sheet-auth-javascript-examples-google-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/damiansire/google-sheet-auth-javascript-examples-google-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fgoogle-sheet-auth-javascript-examples-google-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fgoogle-sheet-auth-javascript-examples-google-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fgoogle-sheet-auth-javascript-examples-google-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fgoogle-sheet-auth-javascript-examples-google-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/damiansire","download_url":"https://codeload.github.com/damiansire/google-sheet-auth-javascript-examples-google-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/damiansire%2Fgoogle-sheet-auth-javascript-examples-google-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32454105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["auth","authentication","google-sheets","google-sheets-api","google-sheets-api-v4","javascript","nodejs"],"created_at":"2024-11-07T08:15:28.953Z","updated_at":"2026-04-30T03:35:25.755Z","avatar_url":"https://github.com/damiansire.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Obtaining Google Service Account Credentials\r\n\r\nThis project uses Google Service Accounts to securely authenticate with Google APIs. Follow these steps to obtain and use your credentials:\r\n\r\n### 1. Create a Service Account:\r\n\r\n1. Visit the [Google Cloud Console: Create Service Account Key](https://console.cloud.google.com/apis/credentials/serviceaccountkey) page.\r\n2. From the **Service account** dropdown, select **New service account**.\r\n3. Give your service account a descriptive name (e.g., \"Spreadsheet Data Reader\").\r\n4. Optionally, assign a role to the service account that gives it the necessary permissions for your task (e.g., \"Sheets Viewer\" if you only need to read data).\r\n5. Click **Create**.\r\n6. In the \"Grant this service account access to project\" dialog, you can optionally grant more specific permissions. Be mindful of the principle of least privilege and only grant what's necessary.\r\n7. Click **Continue**.\r\n8. In the \"Grant users access to this service account\" dialog, you can add other users who should be able to manage this service account. This is optional.\r\n9. Click **Done**.\r\n\r\n### 2. Download the Key File:\r\n\r\n1. On the Service Accounts page, you'll see your newly created service account.\r\n2. Click on the email address of the service account.\r\n3. Go to the **Keys** tab.\r\n4. Click **Add Key** and select **Create new key**.\r\n5. Choose the **JSON** key type.\r\n6. Click **Create**. Your key file will be downloaded automatically.\r\n\r\n**Important Security Note:**\r\n\r\n- **Keep your JSON key file confidential!** Do not share it publicly or commit it to version control. Treat it like a password.\r\n\r\n### 3. Use the Credentials in Your Code:\r\n\r\n**Option A: Environment Variable**\r\n\r\n1. Rename the downloaded key file to `credentials.json` (or any name you prefer).\r\n2. Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the full path of the key file:\r\n\r\n   ```bash\r\n   export GOOGLE_APPLICATION_CREDENTIALS=\"/path/to/your/credentials.json\"\r\n   ```\r\n\r\n**Option B: `keyFile` Property**\r\n\r\n1. In your Node.js code, provide the path to the key file when creating your `GoogleAuth` instance:\r\n\r\n   ```javascript\r\n   const { google } = require(\"googleapis\");\r\n\r\n   const auth = new google.auth.GoogleAuth({\r\n     keyFile: \"/path/to/your/credentials.json\", // Update with the actual path\r\n     scopes: [\r\n       \"[https://www.googleapis.com/auth/spreadsheets.readonly](https://www.googleapis.com/auth/spreadsheets.readonly)\",\r\n     ], // Or the necessary scopes for your tasks\r\n   });\r\n   ```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamiansire%2Fgoogle-sheet-auth-javascript-examples-google-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdamiansire%2Fgoogle-sheet-auth-javascript-examples-google-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdamiansire%2Fgoogle-sheet-auth-javascript-examples-google-api/lists"}