{"id":27942924,"url":"https://github.com/posit-dev/connectcreds","last_synced_at":"2025-07-24T23:40:28.679Z","repository":{"id":267676253,"uuid":"895238872","full_name":"posit-dev/connectcreds","owner":"posit-dev","description":"Bringing Posit Connect's viewer-based credentials to R","archived":false,"fork":false,"pushed_at":"2025-02-26T15:50:19.000Z","size":85,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-07T11:58:50.286Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/posit-dev.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-27T20:26:42.000Z","updated_at":"2025-03-10T16:39:46.000Z","dependencies_parsed_at":"2024-12-11T19:41:38.315Z","dependency_job_id":"b1e9cf72-8078-4ccd-8329-0ee311154362","html_url":"https://github.com/posit-dev/connectcreds","commit_stats":null,"previous_names":["posit-dev/connectcreds"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fconnectcreds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fconnectcreds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fconnectcreds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posit-dev%2Fconnectcreds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posit-dev","download_url":"https://codeload.github.com/posit-dev/connectcreds/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252873975,"owners_count":21817711,"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":[],"created_at":"2025-05-07T11:58:55.941Z","updated_at":"2025-05-07T11:58:56.709Z","avatar_url":"https://github.com/posit-dev.png","language":"R","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 = \"100%\"\n)\n```\n\n# connectcreds\n\n\u003c!-- badges: start --\u003e\n[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html)\n[![R-CMD-check](https://github.com/posit-dev/connectcreds/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/posit-dev/connectcreds/actions/workflows/R-CMD-check.yaml)\n\u003c!-- badges: end --\u003e\n\n`connectcreds` provides low-level utilities for Shiny developers and R package\nauthors building tools that make use of Posit Connect's [viewer-based\ncredentials](https://docs.posit.co/connect/admin/integrations/oauth-integrations/).\n\n## Installation\n\nYou can install connectcreds from CRAN with:\n\n``` r\ninstall.packages(\"connectcreds\")\n```\n\nOr, install the development version of connectcreds from\n[GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"pak\")\npak::pak(\"posit-dev/connectcreds\")\n```\n\n## Usage\n\n`connectcreds` includes helper functions for implementing Posit Connect's\nviewer-based credentials in Shiny applications. These helpers are meant to be\ncalled in the context of a Shiny server function, as follows:\n\n```{r shiny-server-fn}\nserver \u003c- function(input, output, session) {\n  token \u003c- \"PAT for local development\"\n  if (connectcreds::has_viewer_token()) {\n    token \u003c- connectcreds::connect_viewer_token()\n  }\n\n  # ...\n}\n```\n\nUsually, though, these helpers will be used internally by packages that\nauthenticate with various services. For example, here is a simplified version of\n`gh::gh_token()` that returns a GitHub OAuth token for the viewer on Connect but\nuses a GitHub personal access token when testing locally:\n\n```{r gh-token}\ngh_token \u003c- function() {\n  rlang::check_installed(\"connectcreds\", \"for viewer-based authentication\")\n  if (connectcreds::has_viewer_token(\"https://github.com\")) {\n    token \u003c- connectcreds::connect_viewer_token(\"https://github.com\")\n    return(token$access_token)\n  }\n  Sys.getenv(\"GITHUB_PAT\")\n}\n\nserver \u003c- function(input, output, session) {\n  # A Shiny output that shows the user's GitHub username:\n  output$gh_handle \u003c- renderText({\n    resp \u003c- gh::gh_whoami(.token = gh_token())\n    resp$login\n  })\n\n  # ...\n}\n```\n\n## License\n\nMIT (c) [Posit Software, PBC](https://posit.co)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposit-dev%2Fconnectcreds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposit-dev%2Fconnectcreds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposit-dev%2Fconnectcreds/lists"}