> For the complete documentation index, see [llms.txt](https://azutopia.gitbook.io/authly/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://azutopia.gitbook.io/authly/readme.md).

# Welcome to Authly

Production-ready OAuth 2.0, OpenID Connect, and FAPI authentication library for Crystal.

**Authly** is a strongly-typed, zero-framework Crystal shard for building **OAuth 2.0**, **OpenID Connect (OIDC)**, and **Financial-grade API (FAPI)** Authorization Servers and Resource Servers on top of Crystal's standard `HTTP::Handler`.

***

## Documentation Sections

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>🎓 Tutorials</strong></td><td>Step-by-step guided lessons that take you from a blank Crystal project to a working OAuth2 server and protected API.</td><td><a href="/authly/tutorials/tutorials.md">Overview</a></td></tr><tr><td><strong>🛠️ How-To Guides</strong></td><td>Goal-oriented recipes for Redis stores, scope enforcement, PAR, JARM, mTLS, key rotation, and Dynamic Client Registration.</td><td><a href="/authly/how-to-guides/how-to.md">Overview</a></td></tr><tr><td><strong>📖 Reference</strong></td><td>Complete technical specifications for <code>Authly::Configuration</code>, HTTP endpoints, Crystal interfaces, and error codes.</td><td><a href="/authly/reference/reference.md">Overview</a></td></tr><tr><td><strong>💡 Explanation</strong></td><td>Deep dives into Authly's architecture, refresh token rotation families, atomic single-use credentials, and threat model.</td><td><a href="/authly/explanation/explanation.md">Overview</a></td></tr></tbody></table>

***

## Quick Installation

{% tabs %}
{% tab title="shard.yml" %}

```yaml
dependencies:
  authly:
    github: azutoolkit/authly
```

{% endtab %}

{% tab title="Terminal" %}

```bash
shards install
```

{% endtab %}
{% endtabs %}

***

## Capabilities at a Glance

| Category                | Supported Specifications & Features                                                                                                                                                                                                                                                                                                                                         |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **OAuth 2.0 Grants**    | Authorization Code (`authorization_code`), PKCE (`S256` / `plain`), Client Credentials (`client_credentials`), Refresh Token (`refresh_token`), Device Authorization (`urn:ietf:params:oauth:grant-type:device_code`), Cryptographic Challenge-Response (`challenge_response` / `urn:ietf:params:oauth:grant-type:challenge`), Password (`password`), Implicit (`implicit`) |
| **OpenID Connect**      | ID Tokens, UserInfo Endpoint (`/oauth/userinfo`), OIDC Discovery (`/.well-known/openid-configuration`), RFC 8414 Metadata (`/.well-known/oauth-authorization-server`), JWKS (`/.well-known/jwks.json`)                                                                                                                                                                      |
| **FAPI & Hardening**    | Pushed Authorization Requests (PAR / RFC 9126), JWT Secured Authorization Response Mode (JARM / RFC 9101), Certificate-Bound mTLS Tokens (`cnf.x5t#S256` / RFC 8705), Dynamic Client Registration (RFC 7591)                                                                                                                                                                |
| **Resource Protection** | `Authly::Handler::Bearer` (RFC 6750), `Authly::Handler::RequireScope` (`all` / `any`), Audience (`aud`) verification, JWT & Opaque token strategies                                                                                                                                                                                                                         |

***

## Start Building

{% content-ref url="/pages/AByNuSoPCgmfM08w1pFQ" %}
[Getting Started: First OAuth2 Server & API](/authly/tutorials/tutorials/getting-started.md)
{% endcontent-ref %}

{% content-ref url="/pages/JkNZo004axXaA91S5l39" %}
[Cryptographic Challenge-Response Auth](/authly/tutorials/tutorials/challenge-response-auth.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://azutopia.gitbook.io/authly/readme.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
