# Initial Redirect

To start the OAuth 2.0 flow, you will need to redirect the user to `https://matrica.io/oauth2`.

Make sure to include the params below, url encoded as query string params.

**Required fields:**

* `client_id`: Your application Client ID.
* `response_type`: Must be set to `code`.
* `redirect_uri`: One of the URIs set in your application.
* `scope`: String representing the list of the scopes that your app is requesting, each scope must be separated by a space.
* `code_challenge`: PCKE code challenge.
* `code_challenge_method`: PKCE code challenge method. Must be set to `S256`.

Optional fields:

* `state`: **Highly recommended.** The `state` parameter is used by the application to store request-specific data and/or prevent CSRF attacks. More info [here](https://auth0.com/docs/secure/attack-protection/state-parameters).

Example of a redirect request:

`https://matrica.io/oauth2?client_id=123465&scope=profile&response_type=code&redirect_uri=https%3A%2F%2Fexample.com%2Fcallback&code_challenge=q1512316q&code_challenge_method=S256&state=x1561axa165`


---

# 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.matrica.io/matrica-connect/initial-redirect.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.
