Learn R Programming

GAR (version 1.1)

getRefresh: Retrieves a Google Analytics refresh token using a pre-retrieved and authenciated code. A refresh token can be used to repeating obtain a new access token without additional manual authentication.

Description

This function retrieves a Google Analytics refresh token using a supplied credentials and code. The function will use GAR_CLIENT_ID, GAR_CLIENT_SECRET environmental variables if present. A refresh token can be traded for an access token repeatedly. As a result, this should only be needed one time unless the refresh token is revoked or lost. The refresh token is stored in an 'GAR_REFRESH_TOKEN' environmental variable.

Usage

getRefresh(client_id, client_secret, code)

Arguments

client_id
Client ID found in API Console. String format.
client_secret
Client Secret found in API Console. String format.
code
Code obtained from the redirect URL provided by the getCode() function. String format.

Value

Refresh token is a string to be used in conjunction with tokenRefresh() function.

Details

Function returns a GA refresh token.

References

https://developers.google.com/analytics/devguides/reporting/core/v3/

See Also

GAR gaRequest getCode getRefresh tokenRefresh

Examples

Run this code

getRefresh(
            client_id="ABCDEFG",
            client_secret="HIJKLMNOP",
            code="QRSTUVWX"
            )

Run the code above in your browser using DataLab