> For the complete documentation index, see [llms.txt](https://docs.edgetag.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.edgetag.io/api/getting-started/oauth-2.0/implementation.md).

# Implementation

When we created the OAuth connection, we made every effort to follow version 2.0 as closely as possible. You will need to complete the following three steps:

1\) **Redirect**: When the user clicks on "Login With EdgeTag," you should generate a URL that directs them to EdgeTag.

2\) **Exchange Code for Token**: After the user is redirected back, take the code provided in the URL and exchange it for access and refresh tokens.

3\) **Refresh Token**: The access token expires every 2 hours, so before it expires, you need to call the token endpoint to obtain a new access token using the refresh token.

### Enviourments

We have two environments that you can use. We suggest that you start with the sandbox and then move it to production.

#### **Sandbox**:&#x20;

**UI**: <https://app-sandbox.edgetag.io>

**API**: <https://api-sandbox.edgetag.io>

#### **Production**:&#x20;

**UI**: <https://app.edgetag.io>

**API**: <https://api.edgetag.io>

Now, let’s dive in and learn how to generate the redirect URL.

{% content-ref url="/pages/rmc0oYnuFG8Cc1dp9rIl" %}
[Creating redirect](/api/getting-started/oauth-2.0/implementation/creating-redirect.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.edgetag.io/api/getting-started/oauth-2.0/implementation.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.
