The following provides guidance on how to use an API key when using R Studio with the Crunch library and the Quick Editor. Instead of using a username/password, you must use an API key to authenticate. Crunch strives to ensure the best possible security possible in order to interact with its app, and using API keys is part of this initiative.
Finding your API key
You can find your API Key under User Settings in the Crunch.io app (the menu in the top-right corner). See the following help article for more information:
Setting up an API key in R/R Studio
You must configure R Studio to work with an API Key. This only takes a moment and the following video tutorial walks you through the process:
The process is also documented in the following Crunch R package library page:
Another benefit of setting it up this way is that you no longer need to enter a password every time.
Please note, you must use a subdomain for your account where the relevant datasets are hosted. To illustrate, if the URL that you access the dataset is acme.crunch.io then "acme" is your subdomain:
R_CRUNCH_API = "https://subdomain.crunch.io/api"
Please contact Crunch Support if you do not have a subdomain set up yet.
How is an API key different than the username and password?
Passwords are generally considered an insecure form of authentication because weak passwords can be set, might be observed by someone else while you're entering them, or can be obtained easily from a conversation (such as over a phone call). See the following for more information:
What are the advantages of using an API key?
There are two distinct advantages of using an API key:
- Ease-of-use: you never need to log in again.
- Codesharing: username and password are never stored in files.
Why should I use an API key if I don’t use a single sign-on (SSO)?
RCrunch will only accept API keys as of April 1, 2022.
Do I need to use an API key for Crunch Automation scripts?
Will my clients need to use an API key?
No. Your clients are not using RCrunch.
Will an API key fix an issue when R crunch times out?
No, but the Crunch team can show you how to configure a timeout window in R.