How should I deal with twitter auth token in shinyapp?

Viewed 189

I built simple shinyapp that download tweets from a particular account and display some simple statistics and graphs (sentiment analysis, word clouds, etc.). I used the rtweet package. I would like to publish it at https://www.shinyapps.io/. The app works as intended locally using twitter auth token saved as a global environment.

How should I safely authorize my app publishing it online? Hardcoding my API keys into the script feels a terrible idea.

1 Answers

You could use library(secret) and add your API key to a vault. In your shiny application you add a field where your privat key needs to be provided and with this key you can get the API key from the vault.

Alternatively, you can add a field in your APP where the api key needs to be entered directly.

Related