Last active
January 25, 2020 19:26
-
-
Save bryanhanson/5d02c55b8e1178e84b7c119a7c6ca92b to your computer and use it in GitHub Desktop.
Set up Github authorization on your local machine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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