# Step 3: Request an Access Token

To make authenticated requests on behalf of the user, the `authorization_code` must be exchanged for an access token. To request an access token, your application should send the this request.

Store both the `access_token` and the `refresh_token`. The access token can be used immediately to make authenticated requests but it expires after the `expires_in` seconds. The refresh token can be used to refresh both tokens.

{% hint style="info" %}
**Note:** Be sure to set the `Content-Type` header field of your request to:&#x20;

`Content-Type: application/x-www-form-urlencoded`
{% endhint %}

A valid request should follow this format (line breaks added for clarity):

```
GET https://garageio.com/oauth/v2/endpoints/token/?
    client_id=<CLIENT_ID>&
    client_secret=<CLIENT_SECRET>&
    grant_type=authorization_code&
    code=<AUTHORIZATION_CODE>&
    redirect_uri=<ENCODED_REDIRECT_URL>
```


---

# 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.beamlabs.io/oauth/how-to-authorize-access/step-3-request-an-access-token.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.
