Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add OAuth2 token hook authentication #1553

Merged
merged 3 commits into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions docs/hydra/guides/updating-claims-at-refresh.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Use the Ory CLI with following keys to enable this feature:

```shell title="Enable the generic token hook"
ory patch oauth2-config {project.id} \
--add "/oauth2/token_hook=\"https://my-example.app/token-hook\"" \
--add '/oauth2/token_hook/url="https://my-example.app/token-hook"' \
--format yaml
```

Expand Down Expand Up @@ -87,6 +87,20 @@ The token hook endpoint must accept the following payload format:

:::

### Webhook authentication

The webhook supports API key authentication. You can configure whether the API key is sent as a cookie or in a header, and the
cookie/header name:

```shell title="Add an API key to the token hook"
ory patch oauth2-config {project.id} \
--add '/oauth2/token_hook/auth/type="api_key"' \
--add '/oauth2/token_hook/auth/config/in="header"' `# or cookie` \
--add '/oauth2/token_hook/auth/config/name="X-API-Key"' \
--add '/oauth2/token_hook/auth/config/value="MY API KEY"' \
--format yaml
```

### Requester payload

For `jwt-bearer` grant type the `assertion` value is also sent to the webhook URL.
Expand Down Expand Up @@ -188,7 +202,7 @@ Use the Ory CLI with following keys to enable this feature:

```shell title="Enable the refresh token hook"
ory patch oauth2-config {project.id} \
--add "/oauth2/refresh_token_hook=\"https://my-example.app/token-refresh-hook\"" \
--add '/oauth2/refresh_token_hook/url="https://my-example.app/token-refresh-hook"' \
--format yaml
```

Expand Down
Loading