oauth_app: Create an OAuth application.

Description Usage Arguments See Also Examples

View source: R/oauth-app.r

Description

The OAuth framework doesn't match perfectly to use from R. Each user of the package for a particular OAuth enabled site must create their own application. See the demos for instructions on how to do this for linkedin, twitter, vimeo, facebook, github and google.

Usage

1
oauth_app(appname, key, secret = NULL, redirect_uri = oauth_callback())

Arguments

appname

name of the application. This is not used for OAuth, but is used to make it easier to identify different applications and provide a consistent way of storing secrets in environment variables.

key

consumer key (equivalent to a user name)

secret

consumer secret. This is not equivalent to a password, and is not really a secret. If you are writing an API wrapper package, it is fine to include this secret in your package code.

Use NULL to not store a secret: this is useful if you're relying on cached OAuth tokens.

redirect_uri

The URL that user will be redirected to after authorisation is complete. You should generally leave this as the default unless you're using a non-standard auth flow (like with shiny).

See Also

Other OAuth: oauth1.0_token, oauth2.0_token, oauth_endpoint, oauth_service_token

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
# These work on my computer because I have the right envvars set up
linkedin_app <- oauth_app("linkedin", key = "outmkw3859gy")
github_app <- oauth_app("github", "56b637a5baffac62cad9")

## End(Not run)

# If you're relying on caching, supply an explicit NULL to
# suppress the warning message
oauth_app("my_app", "mykey")
oauth_app("my_app", "mykey", NULL)

Example output

Warning message:
Couldn't find secret in environment variable LINKEDIN_CONSUMER_SECRET 
Warning message:
Couldn't find secret in environment variable GITHUB_CONSUMER_SECRET 
<oauth_app> my_app
  key:    mykey
  secret: <not supplied>
Warning message:
Couldn't find secret in environment variable MY_APP_CONSUMER_SECRET 
<oauth_app> my_app
  key:    mykey
  secret: <not supplied>

httr documentation built on Aug. 20, 2017, 5:06 p.m.