bitly_auth: Assign bit.ly API tokens using OAuth2.0

View source: R/ApiKey.R

bitly_authR Documentation

Assign bit.ly API tokens using OAuth2.0

Description

There are 2 ways of how you can authenticate using this package.

1. The recommended practise for the end-user of this package is to use default API keys which are provided using this method.

2. Alternatively, you can register your own application via the web in order to get Client ID and Client Secret code.

For that go first to https://app.bitly.com/settings/integrations/. Click REGISTERED OAUTH APPLICATIONS, then REGISTER NEW APPLICATION followed by GET REGISTRATION CODE. Open your email that you will receive and click COMPLETE REGISTRATION. Make up an APPLICATION NAME that is unique. Unless you know to do otherwise, type "http://localhost:1410/" (slash at the end is important) in REDIRECT URIs. For APPLICATION LINK and APPLICATION DESCRIPTION you can type whatever you like.

Usage

bitly_auth(
  key = "be03aead58f23bc1aee6e1d7b7a1d99d62f0ede8",
  secret = "f9c6a3b18968e991e35f466e90c7d883cc176073",
  debug = F,
  token
)

Arguments

key

- Client ID

secret

- Client Secret

debug

- whether to print additional debug messages

token

- a Token object or a file path to an rds file containing a token.

However Important Information

Before choosing registering new application yourself, you can try using my API keys (the default option). No worries, no information is exposed to me at all: neither what you shorten nor who does it, etc. In fact, quote: "If you are shortening URLs on behalf of end-users, we ask that you use our OAuth 2 implementation to authenticate end-users before shortening. URLs shortened in this manner will be added to the specified end-user's history, allowing the end-user to manage and track the shortened URLs".

WARNING

If using RStudio in the browsers via RStudio Server, then authentication may not work well. In such case, use desktop RStudio application. Look for help at <https://support.rstudio.com/>.

See Also

See https://dev.bitly.com/api-reference

Examples

## Not run: 
# overwrite keys - Variant 2
bitly_token <-
  bitly_auth(
    key = "be03aead58f23bc1aee6e1d7b7a1d99d62f0ede8",
    secret = "f9c6a3b18968e991e35f466e90c7d883cc176073"
  )

# default variant
bitly_token <- bitly_auth()
saveRDS(bitly_token, "bitly_token.rds")
# for non-interactive use:
bitly_auth(token = "bitly_token.rds")

## End(Not run)


urlshorteneR documentation built on Aug. 22, 2022, 9:08 a.m.