authentication: Authenticate yourself with BrandsEye

Description Usage Arguments Details Functions Author(s) Examples

Description

Provides a means to authenticate yourself with the BrandsEye API. Most of the time you will want to do this using a BrandsEye API key.

Usage

1
2
3
4
5
authentication(key = NULL, user = NULL, password = NULL)

authentication_filename()

authenticate(key = NULL, user = NULL, password = NULL, save = FALSE)

Arguments

key

Your API key. Contact your client service representative if you do not already have one. You do not need to have a username or password if you are using an API key.

user

Your username, if you know it. This should be used with your password.

password

To be used in conjunction with a username

save

Set this to true if your authentication details should be saved across sessions.

Details

This function allows you to set a global variable holding your authentication details. The various BrandsEyeR functions will use these authentication details when communicating with the BrandsEye API.

It's possible to set up default authentication information as well which will be loaded automatically every time you load the BrandsEyeR library.

In your home directory, create the file $HOME/.brandseyerd/authentication.json.

This file can contain either a key, or a user / password pair. For example, to specify your key, the file should contain:

{ "key": "12342342342354345" }

To specify a username and password pair, the file should contain:

{ "user": "connie@brandseye.com", "password": "This would be awkward if it were my real password" }

You can use the authenticate function to save a stub file for you to edit in your home directory. On windows, this might be in your My Documents directory. You can use the authentication_filename function to find the directory and file name to save the authentication file in.

You can also use the authenticate file to create the file for you in the appropriate place. Call it with no arguments to just make an empty file. If you provide arguments, it will fill in the file for you, as needed.

Be wary of calling it with arguments, since your key or password will land up in your R history file. The best practise is to call authenticate with only save = TRUE and no other arguments set and edit the file manually. On a shared computer, set permissions on that file so that only your user can read it. Your authentication details are saved in plain text.

Functions

Author(s)

Constance Neeser

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 

authentication("adfd42345f534fgdfgd")
authentication(key = "adfd42345f534fgdfgd")

# Authenticating with a username and password
authentication(user = "jo.blogs@brandseye.com", 
               password ="This is a safe password!!")
               

## End(Not run)

## Not run: 

# Create a json stub to fill in your authentication details:
authenticate(save = TRUE)
# And this will be created at:
authentication_filename()

# Log in for the session
authenticate(key = "this is my api key")
# Use the API with those credentials
account_count("QUIR01BA", "published inthelast month")


## End(Not run)

brandseye/brandseyer documentation built on May 13, 2019, 2:30 a.m.