{"id":30989160,"url":"https://github.com/metadream/deno-gist","last_synced_at":"2026-02-02T14:12:36.028Z","repository":{"id":144612511,"uuid":"608608955","full_name":"metadream/deno-gist","owner":"metadream","description":"An easy way to access Google Drive without any external dependencies.","archived":false,"fork":false,"pushed_at":"2025-05-23T07:39:06.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-14T05:44:35.496Z","etag":null,"topics":["deno","google-apis","google-drive"],"latest_commit_sha":null,"homepage":"https://jsr.io/@focal/gist","language":"TypeScript","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/metadream.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":"2023-03-02T11:25:07.000Z","updated_at":"2025-05-23T07:38:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"b2fa64a4-8061-4822-8ad7-68f836c70a0e","html_url":"https://github.com/metadream/deno-gist","commit_stats":null,"previous_names":["metadream/deno-gist","metadream/deno-google"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/metadream/deno-gist","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metadream%2Fdeno-gist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metadream%2Fdeno-gist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metadream%2Fdeno-gist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metadream%2Fdeno-gist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metadream","download_url":"https://codeload.github.com/metadream/deno-gist/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metadream%2Fdeno-gist/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29012720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T12:48:30.580Z","status":"ssl_error","status_checked_at":"2026-02-02T12:46:38.384Z","response_time":58,"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":["deno","google-apis","google-drive"],"created_at":"2025-09-12T18:04:40.493Z","updated_at":"2026-02-02T14:12:36.023Z","avatar_url":"https://github.com/metadream.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deno-Gist\n\n## GoogleDrive\n\nAn easy way to access Google Drive without any external dependencies.\n\n```ts\nimport { GoogleDrive } from \"https://deno.land/x.google/google-drive.ts\";\n\nconst gd = new GoogleDrive({\n  client_id: \"xxxxx-xxxxxxxxxxxxxx.apps.googleusercontent.com\",\n  client_secret: \"xxxxxxxxxxxxxxx\",\n  refresh_token: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n  logger: false,\n});\n\ntry {\n  // This step can be omitted, and it will reauthorize when requesting data\n  await gd.authorize();\n  // The default value of the path is \"root\"\n  const metadata = await gd.index(\"your/path\");\n\n  if (metadata.isFolder) {\n    console.log(metadata.list());\n  } else {\n    // handle metadata.raw() or metadata.raw(range)\n  }\n} catch (e) {\n  console.log(e);\n}\n```\n\n## GoogleOAuth\n\nThis class is a simplification of the google oauth2 authorization flow.\n\n### 1. Create an instance\n\n```ts\nimport { GoogleOAuth } from \"https://deno.land/x/google/google-oauth.ts\";\n\nconst ga = new GoogleOAuth({\n  client_id: \"xxxxx-xxxxxxxxxxxxxx.apps.googleusercontent.com\",\n  client_secret: \"xxxxxxxxxxxxxxx\",\n  redirect_uri: \"http://example.com/redirect_uri\",\n  \"scopes\": [\n    \"https://www.googleapis.com/auth/userinfo.email\",\n    \"https://www.googleapis.com/auth/drive.readonly\",\n  ],\n});\n\nconst link = ga.buildAuthLink();\n```\n\n### 2. Visit the link\n\nAfter clicking the link to complete the authorization, it will redirect to the\nuri with the \"code\" parameter. You can receive the \"code\" in redirect_uri.\n\n### 3. Get tokens\n\n```ts\n// tokens include refresh_token, access_token, id_token, etc.\n// But the access_token has an expiry time, so you need to get it again through the next step\nconst tokens = await ga.getTokens(code);\n```\n\n### 4. Get access_token\n\n```ts\n// refresh_token is obtained in the previous step, it is permanently valid.\nconst accessToken = ga.getAccessToken(refresh_token);\n```\n\n### 5. Decode id_token (without verifiy signature)\n\nThe id_token obtained in the third step contains some personal information of\nthe google account, you can decode it.\n\n```ts\nconst data = ga.decodeIdToken(id_token);\n// it will return { header, payload, signature }\n// payload is the personal information\n```\n\n### 6. Decode id_token (verify signature via CERTS_URL)\n\nIt is usually not necessary to verify the signature for the first authorization,\nbut it is strongly recommended to verify when you use the id_token as a cookie\nto keep the login state.\n\n**NOTE: There is a bug in this method, which is caused by the type of\n\"cryptoKey\", and I don't know how to solve it for the time being.**\n\n```ts\nconst data = await ga.verifyIdToken(id_token);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetadream%2Fdeno-gist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetadream%2Fdeno-gist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetadream%2Fdeno-gist/lists"}