{"id":19534651,"url":"https://github.com/buttercup/google-oauth2-client","last_synced_at":"2025-04-26T14:35:13.766Z","repository":{"id":44948383,"uuid":"197903374","full_name":"buttercup/google-oauth2-client","owner":"buttercup","description":"Google OAuth2 authentication client","archived":false,"fork":false,"pushed_at":"2023-11-11T05:47:18.000Z","size":568,"stargazers_count":9,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T16:58:14.385Z","etag":null,"topics":["google-authentication","google-oauth2","oauth2","oauth2-client"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buttercup.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-07-20T08:39:13.000Z","updated_at":"2023-07-26T06:44:28.000Z","dependencies_parsed_at":"2023-11-14T13:10:39.251Z","dependency_job_id":null,"html_url":"https://github.com/buttercup/google-oauth2-client","commit_stats":{"total_commits":55,"total_committers":4,"mean_commits":13.75,"dds":0.09090909090909094,"last_synced_commit":"ac53dab926f1a68378c0c5764829d84e40a3c670"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buttercup%2Fgoogle-oauth2-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buttercup%2Fgoogle-oauth2-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buttercup%2Fgoogle-oauth2-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buttercup%2Fgoogle-oauth2-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buttercup","download_url":"https://codeload.github.com/buttercup/google-oauth2-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223194748,"owners_count":17104001,"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":["google-authentication","google-oauth2","oauth2","oauth2-client"],"created_at":"2024-11-11T02:15:03.364Z","updated_at":"2024-11-11T02:15:04.762Z","avatar_url":"https://github.com/buttercup.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google OAuth2 Client\n\u003e Minimal compatibility-first Google OAuth2 client implementation\n\n[![Buttercup](https://cdn.rawgit.com/buttercup-pw/buttercup-assets/6582a033/badge/buttercup-slim.svg)](https://buttercup.pw) [![npm version](https://badge.fury.io/js/%40buttercup%2Fgoogle-oauth2-client.svg)](https://www.npmjs.com/package/@buttercup/google-oauth2-client) ![Tests status](https://github.com/buttercup/google-oauth2-client/actions/workflows/test.yml/badge.svg)\n\n## About\n\nThis library is a minimal implementation of the [`google-auth-library`](https://github.com/googleapis/google-auth-library-nodejs) project, designed to be compatible with NodeJS, the browser and React Native. The `google-auth-library` package has had [problems with compatibility](https://github.com/googleapis/google-auth-library-nodejs/issues/150) in this regard and rather than wait for that to get sorted, this library was released to solve the exact problem without the overhead of project politics, wait times and package excess (extra features not needed that are causing the incompatibilities in the first place).\n\nThis library is targeted at NodeJS but should work everywhere.\n\n## Usage\n\nInstall by running `npm install @buttercup/google-oauth2-client --save`.\n\nImport the `OAuth2Client` class to get started, similarly to the original implemenation:\n\n```javascript\nimport { OAuth2Client } from \"@buttercup/google-oauth2-client\";\n\nconst client = new OAuth2Client(\n    \"my-client-id\",\n    \"my-client-secret\",\n    \"http://redirect.uri\"\n);\n\nconst authURL = client.generateAuthUrl(/* ... */);\n```\n\n### Implemented features\n\nThe following methods are implemented:\n\n| Method                | Example                           | Description                               |\n|-----------------------|-----------------------------------|-------------------------------------------|\n| `generateAuthUrl`     | `generateAuthUrl({ access_type: \"offline\", prompt: \"consent\", scope: \"profile\" })` | Generate an authorisation URL |\n| `exchangeAuthCodeForToken` | `await exchangeAuthCodeForToken(authCode)` | Get the tokens for an authorisation code |\n| `refreshAccessToken`  | `await refreshAccessToken(refreshToken`)| Refresh the tokens                  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuttercup%2Fgoogle-oauth2-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuttercup%2Fgoogle-oauth2-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuttercup%2Fgoogle-oauth2-client/lists"}