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

Implement this behaviour in the application layer of your OAuth / OpenID Connect provider.
This behaviour gives all callbacks triggered invoking `Backplane.Oauth` module functions.

> __Note__: This behaviour is split into `Backplane.Oauth.AuthorizeApplication`, `Backplane.Oauth.TokenApplication`, `Backplane.Oauth.IntrospectApplication`, and `Backplane.Oauth.RevokeApplication` providing utilities to implement the different OAuth / OpenID Connect endpoints independently.

# `authorize_error`

```elixir
@callback authorize_error(conn :: Plug.Conn.t(), oauth_error :: Backplane.Oauth.Error.t()) ::
  any()
```

This function will be triggered in case of failure invoking `Backplane.Oauth.authorize/3`

# `authorize_success`

```elixir
@callback authorize_success(
  conn :: Plug.Conn.t(),
  authorize_response :: Backplane.Oauth.AuthorizeResponse.t()
) :: any()
```

This function will be triggered in case of success invoking `Backplane.Oauth.authorize/3`

# `introspect_error`

```elixir
@callback introspect_error(
  conn :: Plug.Conn.t(),
  oauth_error :: Backplane.Oauth.Error.t()
) :: any()
```

This function will be triggered in case of failure invoking `Backplane.Oauth.introspect/2`

# `introspect_success`

```elixir
@callback introspect_success(
  conn :: Plug.Conn.t(),
  introspect_response :: Backplane.Oauth.IntrospectResponse.t()
) :: any()
```

This function will be triggered in case of success invoking `Backplane.Oauth.introspect/2`

# `preauthorize_error`
*optional* 

```elixir
@callback preauthorize_error(
  conn :: Plug.Conn.t(),
  oauth_error :: Backplane.Oauth.Error.t()
) :: any()
```

This function will be triggered in case of failure invoking `Backplane.Oauth.preauthorize/3`

# `preauthorize_success`
*optional* 

```elixir
@callback preauthorize_success(
  conn :: Plug.Conn.t(),
  authorization :: Backplane.Oauth.AuthorizationSuccess.t()
) :: any()
```

This function will be triggered in case of success invoking `Backplane.Oauth.preauthorize/3`

# `revoke_error`

```elixir
@callback revoke_error(conn :: Plug.Conn.t(), oauth_error :: Backplane.Oauth.Error.t()) ::
  any()
```

This function will be triggered in case of failure invoking `Backplane.Oauth.revoke/2`

# `revoke_success`

```elixir
@callback revoke_success(conn :: Plug.Conn.t()) :: any()
```

This function will be triggered in case of success invoking `Backplane.Oauth.revoke/2`

# `token_error`

```elixir
@callback token_error(conn :: Plug.Conn.t(), oauth_error :: Backplane.Oauth.Error.t()) ::
  any()
```

This function will be triggered in case of failure invoking `Backplane.Oauth.token/2`

# `token_success`

```elixir
@callback token_success(
  conn :: Plug.Conn.t(),
  token_response :: Backplane.Oauth.TokenResponse.t()
) :: any()
```

This function will be triggered in case of success invoking `Backplane.Oauth.token/2`

---

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