> For the complete documentation index, see [llms.txt](https://docs.cotter.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cotter.app/getting-access-token/getting-the-tokens.md).

# Getting the Tokens

Getting Cotter's OAuth Tokens is very easy using our current authentication methods. **You should automatically receive the `oauth_token` whenever a user is succesfully authenticated**, either using magic link, OTP, trusted device, or WebAuthn.

You will get an `oauth_token` object in the JSON response with all the tokens:

```javascript
{
  ...
  "oauth_token": {
    "access_token": "eyJhbGciOiJFUzI1sInR5cC...",
    "auth_method": "TRUSTED_DEVICE", // authentication method used
    "expires_in": 3600,              // expiry in seconds
    "id_token": "eyJhbGciOiJFUz...",
    "refresh_token": "60:79hbLxl3aTjWWgCcIRnn...",
    "token_type": "Bearer"
  }
}
```

## Getting Tokens using the SDK

There are 3 places in the existing SDK where you can receive access tokens:

{% content-ref url="/pages/-M4HjKz1atn3w5W-syVN" %}
[During Email/Phone Verification](/getting-access-token/older-api/getting-the-tokens/during-authentication/during-email-phone-verification.md)
{% endcontent-ref %}

{% content-ref url="/pages/-M4I2UtJdxzuT\_JMHsKv" %}
[During Authentication](/getting-access-token/older-api/getting-the-tokens/during-authentication.md)
{% endcontent-ref %}

{% content-ref url="/pages/-M4IuiqhSaH4ha2Ye8zu" %}
[During enrolling Trusted Devices](/getting-access-token/older-api/getting-the-tokens/during-enrolling-trusted-devices.md)
{% endcontent-ref %}

## Getting Tokens using HTTP Request

You can also call Cotter's API to get the tokens.

{% content-ref url="/pages/-M4JGrVHEcLJ12a9rzYj" %}
[Using the Refresh Token](/getting-access-token/getting-the-tokens/using-http-requests.md)
{% endcontent-ref %}
