{"id":13736395,"url":"https://github.com/r-lib/gargle","last_synced_at":"2025-04-12T14:56:19.800Z","repository":{"id":46250260,"uuid":"48555251","full_name":"r-lib/gargle","owner":"r-lib","description":"Infrastructure for calling Google APIs from R, including auth","archived":false,"fork":false,"pushed_at":"2024-04-01T17:47:43.000Z","size":5132,"stargazers_count":113,"open_issues_count":33,"forks_count":35,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-11T07:36:16.629Z","etag":null,"topics":["authentication","google","package","r","rstats"],"latest_commit_sha":null,"homepage":"https://gargle.r-lib.org/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-lib.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-12-24T19:53:03.000Z","updated_at":"2024-09-07T06:00:54.000Z","dependencies_parsed_at":"2024-06-18T21:21:35.816Z","dependency_job_id":"41fadd3c-34e1-4feb-b7bc-8bc11cb251e8","html_url":"https://github.com/r-lib/gargle","commit_stats":{"total_commits":805,"total_committers":20,"mean_commits":40.25,"dds":0.09068322981366461,"last_synced_commit":"ef00eb0581a8eda05185a3a6348f80cff522dd76"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fgargle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fgargle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fgargle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-lib%2Fgargle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-lib","download_url":"https://codeload.github.com/r-lib/gargle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586244,"owners_count":21128996,"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":["authentication","google","package","r","rstats"],"created_at":"2024-08-03T03:01:21.041Z","updated_at":"2025-04-12T14:56:19.779Z","avatar_url":"https://github.com/r-lib.png","language":"R","funding_links":[],"categories":["Backend","R"],"sub_categories":["Authentication"],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"50%\"\n)\n```\n# gargle\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/gargle)](https://cran.r-project.org/package=gargle)\n[![Codecov test coverage](https://codecov.io/gh/r-lib/gargle/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/gargle?branch=main)\n[![R-CMD-check](https://github.com/r-lib/gargle/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/gargle/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\nThe goal of gargle is to take some of the agonizing pain out of working with Google APIs. This includes functions and classes for handling common credential types and for preparing, executing, and processing HTTP requests.\n\nThe target user of gargle is an *R package author* who is wrapping one of the ~250 Google APIs listed in the [APIs Explorer](https://developers.google.com/apis-explorer). gargle aims to play roughly the same role as [Google's official client libraries](https://developers.google.com/api-client-library/), but for R. gargle may also be useful to useRs making direct calls to Google APIs, who are prepared to navigate the details of low-level API access.\n\ngargle's functionality falls into two main domains:\n\n  * **Auth.** The `token_fetch()` function calls a series of concrete\n    credential-fetching functions to obtain a valid access token (or it quietly\n    dies trying).\n    - This covers explicit service accounts, application default credentials,\n      Google Compute Engine, (experimentally) workload identity federation, and\n      the standard OAuth2 browser flow.\n    - gargle offers the `Gargle2.0` class, which extends `httr::Token2.0`. It is\n      the default class for user OAuth 2.0 credentials. There are two main\n      differences from `httr::Token2.0`: greater emphasis on the user's email\n      (e.g. Google identity) and default token caching is at the user level.\n  * **Requests and responses**. A family of functions helps to prepare HTTP\n    requests, (possibly with reference to an API spec derived from a Discovery\n    Document), make requests, and process the response.\n    \nSee the [articles](https://gargle.r-lib.org/articles/) for holistic advice on how to use gargle.\n\n## Installation\n\nYou can install the released version of gargle from [CRAN](https://CRAN.R-project.org) with:\n\n```{r eval = FALSE}\ninstall.packages(\"gargle\")\n```\n\nAnd the development version from [GitHub](https://github.com/) with:\n\n```{r eval = FALSE}\n# install.packages(\"pak\")\npak::pak(\"r-lib/gargle\")\n```\n## Basic usage\n\ngargle is a low-level package and does not do anything visibly exciting on its own.\nBut here's a bit of usage in an interactive scenario where a user confirms they want to use a specific Google identity and loads an OAuth2 token.\n\n```{r eval = FALSE}\nlibrary(gargle)\n\ntoken \u003c- token_fetch()\n#\u003e The gargle package is requesting access to your Google account.\n#\u003e Enter '1' to start a new auth process or select a pre-authorized account.\n#\u003e 1: Send me to the browser for a new auth process.\n#\u003e 2: janedoe_personal@gmail.com\n#\u003e 3: janedoe@example.com\n#\u003e Selection: 2\n\ntoken\n#\u003e ── \u003cToken (via gargle)\u003e ─────────────────────────────────────────────────────\n#\u003e oauth_endpoint: google\n#\u003e            app: gargle-clio\n#\u003e          email: janedoe_personal@gmail.com\n#\u003e         scopes: ...userinfo.email\n#\u003e    credentials: access_token, expires_in, refresh_token, scope, token_type, id_token\n```\n\nHere's an example of using request and response helpers to make a one-off request to the [Web Fonts Developer API](https://developers.google.com/fonts/docs/developer_api).\nWe show the most popular web font families served by Google Fonts.\n\n```{r}\nlibrary(gargle)\n\nreq \u003c- request_build(\n  method = \"GET\",\n  path = \"webfonts/v1/webfonts\",\n  params = list(\n    sort = \"popularity\"\n  ),\n  key = gargle_api_key(),\n  base_url = \"https://www.googleapis.com\"\n)\nresp \u003c- request_make(req)\nout \u003c- response_process(resp)\n\nout \u003c- out[[\"items\"]][1:8]\nsort(vapply(out, function(x) x[[\"family\"]], character(1)))\n```\n\nPlease note that the 'gargle' project is released with a [Contributor Code of Conduct](https://gargle.r-lib.org/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.\n\n[Privacy policy](https://www.tidyverse.org/google_privacy_policy)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fgargle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-lib%2Fgargle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-lib%2Fgargle/lists"}