Skip to content

Instantly share code, notes, and snippets.

@bryanhanson

bryanhanson/GithubAccess.R

Last active Jan 25, 2020
Embed
What would you like to do?
Set up Github authorization on your local machine
# R code
# Based on https://stackoverflow.com/a/23810363/633251
# This is called "Web Application Flow"
# see https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow
# Follow the instructions there to set up a token. Never share your key or secret.
library("httr")
myapp <- oauth_app("FOSS", key = "pqr", secret = "xyz")
github_token <- oauth2.0_token(oauth_endpoints("github"), myapp)
# In the R console you will have the option to save an authorization file
# or do a one time authorization. Then a web page will open with a message
# and you can close it after reading the message.
# The object github_token is now in your workspace can can be called when
# accessing the Github API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.