Description Usage Arguments Details Value
View source: R/token_management.R
This is the first function you need to call in order to work with other
functions in cdsR. Based on provided credentials it sets up a cds_token S3
generic object. It then lives in R session options
(getOption("cdsR.tokens")
).To get credentials you have to have a
service account. Ask your adminds to provide you with all the secrets or get
more details here.
1 2 3 4 5 6 7 8 | initialize_cds_token(
cds_instance_name,
cds_instance_url,
tenant_id,
client_id,
client_secret,
web_api_version = "9.1"
)
|
cds_instance_name |
A character scalar with the name you want to use in order to identify a particular CDS instance. Typically something like "production", "test" or "dev". Used in other cdsR functions. |
cds_instance_url |
A character scalar with the url of your CDS/Dynamics instance. Should look like "https://yourinstancename.crm4.dynamics.com" |
tenant_id |
A character scalar with GUID of your tenant. Ask your Dynamics admins to provide this when in doubt. |
client_id |
A character scalar with GUID of service account you will use with this CDS instance. Ask your Dynamics admins to provide this when in doubt. |
client_secret |
A character scalar representing the service account's secret. Avoid keeping this in your code! Ask your dynamics admins to provide when in doubt and consult with your org's security expert how to store. |
web_api_version |
A character scalar describing which version of the CDS Web API you want to use when using this 'cds_token'. Default is "9.0". |
This is a very lighweight approach to authentication and is designed to minimise typing in interactive sessions, while still allowing for writing explicit, yet concise production-ready code. Notable features:
All the tokens in getOption("cdsR.tokens")
are automatically
refreshed if token is valid for less than 10 minutes when launching the
odata request.
It is common to work with multiple instances or tenants of CDS or Dynamics. You can call 'initialize_cds_token()' as many times as you want, just make sure that each new instance/tenant you are working with has unique 'cds_instance_name'. The typicall scenario is to use the cdsR in production, testing and development environments just by switching one argument.
If just one token is present, then 'donwload_cds()' picks it up automatically and you do not need to provide the 'cds_instance_name'. Note that function which send destructive data requests (deletes and updates) require to provide instance name.
Note that you can call this function for a cds_instance_name in order to force refresh the token and/or change the url details.
This function returns nothing and is used for side-effect of creating a cds_token object in R session's options to use by other cdsR functions.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.