Description Usage Arguments Details Value Examples
View source: R/authentication.R
Requests a Bearer access token from TrendMiner using an OAuth2.0 resource owner password credentials grant flow.
1 2 3 4 5 6 7 8 |
client_id |
Client identifier issued by the authorization server |
client_secret |
Client secret issued by the authorization server |
usr_name |
Username |
usr_pwd |
User password |
base_url |
TrendMiner base URL |
... |
Additional arguments passed on to the underlying HTTP method.
This might be necessary if you need to set some curl options explicitly
via |
All requests to the TrendMiner API require authentication. This is achieved by sending a valid Bearer access token in the request headers. Request tokens are obtained via OAuth2.0 using the resource owner password credentials flow: Any client which likes to interact with the API needs to collect the credentials from the user (username and password) and passes them together with its own client credentials (client ID and client secret) to the TrendMiner server. The server responds with an access token which the user needs to use for any subsequent API requests.
Note: You can request your client ID and client secret by contacting TrendMiner support or your TrendMiner Customer Success Manager.
User credentials, client credentials and the TrendMiner base URL can be passed
as arguments to tm_token()
for quick testing in interactive mode.
However, it is recommended to call tm_token()
without arguments.
In this case tm_token()
will fetch the credentials and the TrendMiner
base URL from the following environment variables stored in
.Renviron
which you can easily edit using usethis::edit_r_environ()
:
TM_client_ID = YOUR_CLIENT_ID_HERE
TM_secret = YOUR_CLIENT_SECRET_HERE
TM_usr = YOUR_USER_NAME_HERE
TM_pwd = YOUR_USER_PASSWORD_HERE
TM_base_url = YOUR_TM_BASE_URL_HERE
A S3 object of class tm_token
(basically a list) with the following
components:
access_token
The access token which needs to be used for any subsequent API request
token_type
Type of the token which is always "bearer"
expires_in
Token expiration time in seconds
scope
Character string describing the access scope
allowedHistorians
Character string describing the Historians
which can be accessed with the access_token
userId
The user's ID which will be used for any action performed
on the connected TrendMiner instance using the access_token
expiration_date
"POSIXct" object representing the date the token will expire
base_url
TrendMiner base URL
1 2 3 4 | ## Not run:
tm_token()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.