# Getting the oAuth Access and Refresh Tokens

This appRules process is common to the Datasources using standard oAuth access (vs Client oAuth flow) in order to get access and refreshtokens:

Click on the Connection Parameters button from the datasource definition window:

<figure><img src="https://1923141441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MFjmFrZ8sef1J7qkr6H%2Fuploads%2Fs97TCVyyfUM9wUxVGryN%2Fimage.png?alt=media&#x26;token=d895ae67-0852-40e3-bdf1-e178eea910b3" alt=""><figcaption><p>Sample D365 Business Central Datasource</p></figcaption></figure>

GetAuthorizationURL Procedure (if required)

Click on "Execute" to get the authorization URL, you then will be asked to connect with your credentials to the authorization environment

<figure><img src="https://1923141441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MFjmFrZ8sef1J7qkr6H%2Fuploads%2FpRSGTgmqLQsZiHmM8Qx2%2Fimage.png?alt=media&#x26;token=25add037-6a60-4464-b084-ecb6b1b47b70" alt=""><figcaption></figcaption></figure>

Once done, click on the highlighted "Authorize" button :thumbsup:

<figure><img src="https://1923141441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MFjmFrZ8sef1J7qkr6H%2Fuploads%2FisPH5sMjhaNwfw90WG2G%2Fimage.png?alt=media&#x26;token=e1002e10-9006-4eaf-82eb-621cffc5b33c" alt=""><figcaption></figcaption></figure>

You then obtain your access and refresh tokens, click on the "Return" to update your datasource definition with the obtained values

&#x20;

<figure><img src="https://1923141441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MFjmFrZ8sef1J7qkr6H%2Fuploads%2FwMcIsRNtC86acTXxYpRo%2Fimage.png?alt=media&#x26;token=444ab119-d298-4445-8ece-4bbb5af21711" alt=""><figcaption></figcaption></figure>

The values are copied to the destination properties, you can then click on the below button to test your connection:

<figure><img src="https://1923141441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MFjmFrZ8sef1J7qkr6H%2Fuploads%2Fs9OEpEkJ6hatuMaWH1d3%2Fimage.png?alt=media&#x26;token=77fa4313-b2ba-41df-a5ea-187750bc13dd" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1923141441-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MFjmFrZ8sef1J7qkr6H%2Fuploads%2FNd5YAaVn9W4aLDOws8e5%2Fimage.png?alt=media&#x26;token=1a781db4-8d4d-4fb7-b1cb-555ac9f48776" alt=""><figcaption></figcaption></figure>

Click Save Settings to save your datasource (Connection Settings window) or generate the metadata (Refresh Metadata window)
