# `Backplane.Oauth.AccessTokens`
[🔗](https://github.com/gsmlg-opt/backplane/blob/v1.10.77/apps/backplane_oauth/lib/backplane/oauth/contexts/access_tokens.ex#L1)

Access token context

# `create`

```elixir
@callback create(
  params :: %{
    :client =&gt; Backplane.Oauth.Client.t(),
    :sub =&gt; String.t(),
    optional(:redirect_uri) =&gt; String.t(),
    :scope =&gt; String.t(),
    optional(:state) =&gt; String.t(),
    optional(:previous_token) =&gt; String.t(),
    optional(:resource_owner) =&gt; Backplane.Oauth.ResourceOwner.t()
  },
  options :: [{:refresh_token, boolean()}]
) :: token :: Backplane.Oauth.Token.t() | {:error, reason :: term()}
```

Persists a token with the given params.

# `get_by`

```elixir
@callback get_by([{:value, String.t()}] | [{:refresh_token, String.t()}]) ::
  token :: Backplane.Oauth.Token.t() | nil
```

Returns a `Backplane.Oauth.Token` either by `value` or `refresh_token`.

# `revoke`

```elixir
@callback revoke(token :: Backplane.Oauth.Token.t()) ::
  {:ok, Backplane.Oauth.Token.t()} | {:error, reason :: term()}
```

Revokes the given `Backplane.Oauth.Token`.

# `revoke_refresh_token`

```elixir
@callback revoke_refresh_token(token :: Backplane.Oauth.Token.t()) ::
  {:ok, Backplane.Oauth.Token.t()} | {:error, reason :: term()}
```

Revokes only the given `Backplane.Oauth.Token` refresh token.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
