# 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="/files/3fF02MkcO7heQA7uKLU6" 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="/files/3rIa03rHwUsJO7a1fV1I" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/qLHKBGd37mqXx8te8zlr" 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="/files/9JFN0YPw8fGTPx2tSTLD" 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="/files/Bz9zGtRegaY5zQDYUGyP" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/Upk31MoffGRojnj652Y7" alt=""><figcaption></figcaption></figure>

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.appstrategy.com/apprules-r-documentation/appendix/miscellaneous/getting-the-oauth-access-and-refresh-tokens.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
