> For the complete documentation index, see [llms.txt](https://docs.matrica.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.matrica.io/matrica-connect/initial-redirect.md).

# 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`
