<a id="etsy-oauth2"></a>

# Etsy OAuth2

<a id="backend-class"></a>

## Backend class

For Django, add this class path to `AUTHENTICATION_BACKENDS`. For other
integrations, use the same class path in the framework-specific backend
setting.

| Backend name   | Class path                             |
|----------------|----------------------------------------|
| `etsy`         | `social_core.backends.etsy.EtsyOAuth2` |

Etsy supports the [OAuth 2.0](https://developer.etsy.com/documentation/essentials/authentication) protocol using Authorization code with [Proof Key for Code Exchange (PKCE)](https://datatracker.ietf.org/doc/html/rfc7636) flow.

<a id="configuration"></a>

## Configuration

1. Register a new [Application Link](https://developer.etsy.com/documentation/#developing-a-new-open-api-app) in your Etsy Account.
2. Fill *Client ID* in `SOCIAL_AUTH_ETSY_OAUTH2_KEY` in your project settings:
   ```default
   SOCIAL_AUTH_ETSY_OAUTH2_KEY = "..."
   ```

   Note: *Client Secret* isn’t required via this flow.
3. Enable the backend:
   ```default
   SOCIAL_AUTH_AUTHENTICATION_BACKENDS = (
       ...
       "social_core.backends.etsy.EtsyOAuth2",
       ...
   )
   ```

<a id="extra-configuration"></a>

## Extra Configuration

- You can specify the scope that your application requires:
  ```default
  SOCIAL_AUTH_ETSY_OAUTH2_SCOPE = ["shops_r", "shops_w", ...]
  ```

  You can see all possible values at [Etsy OAuth 2.0 provider API Scopes](https://developer.etsy.com/documentation/essentials/authentication/#scopes).
- You can specify PKCE challenge method:
  ```default
  SOCIAL_AUTH_ETSY_OAUTH2_PKCE_CODE_CHALLENGE_METHOD = '...'
  ```

  The possible value for this is only `S256` which is set by default.

  You can see more information about PKCE at [RFC7636](https://datatracker.ietf.org/doc/html/rfc7636).
