Skip to content

Commit ed8b892

Browse files
Merge pull request #20 from matomo-org/fix-readme
Fixes README to display correctly
2 parents 68b4fdf + ba14767 commit ed8b892

4 files changed

Lines changed: 32 additions & 51 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
5.0.0 - 2026-04-13
1+
5.0.1 - 2026-04-17
2+
- Fixes README.md
23

3-
Initial release to create OAuth 2.0 clients for token generation and API access
4+
5.0.0 - 2026-04-13
5+
- Initial release to create OAuth 2.0 clients for token generation and API access

README.md

Lines changed: 24 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
# OAuth 2.0 Plugin for Matomo
22

3-
This plugin adds a **first-party OAuth 2.0 Authorization Server** to Matomo, allowing external applications to securely access Matomo APIs using OAuth2 access tokens instead of `token_auth`.
4-
5-
It supports standard OAuth 2.0 flows including **Authorization Code (PKCE)**, **Client Credentials**, and **Refresh Token**.
6-
73
[![Build Status](https://github.com/matomo-org/plugin-OAuth2/actions/workflows/matomo-tests.yml/badge.svg)](https://github.com/matomo-org/plugin-OAuth2/actions/workflows/matomo-tests.yml)
84

95
## Description
106

7+
This plugin adds a **first-party OAuth 2.0 Authorization Server** to Matomo, allowing external applications to securely access Matomo APIs using OAuth2 access tokens instead of `token_auth`.
8+
9+
It supports standard OAuth 2.0 flows including **Authorization Code (PKCE)**, **Client Credentials**, and **Refresh Token**.
10+
1111
The OAuth 2.0 plugin replaces static authentication with a token-based flow tied to your existing login system. Each application requests permission, receives scoped access, and operates within defined limits. No need to distribute or manage long-lived credentials across tools and services.
1212

1313
Tokens expire by default, can be refreshed when needed, and revoked instantly without affecting other integrations. This reduces exposure and simplifies access management.
1414

1515
For teams running multiple integrations, OAuth 2.0 is the practical choice for secure, maintainable access to Matomo data. Every connection is authorised, bounded, and straightforward to control.
1616

17-
---
18-
19-
# Features
17+
## Features
2018

2119
- OAuth 2.0 Authorization Server integrated with Matomo
2220
- Manage OAuth clients via **Administration → Platform → OAuth 2.0** (For Matomo Cloud it will be **Administration → Export → OAuth 2.0**)
@@ -34,12 +32,10 @@ For teams running multiple integrations, OAuth 2.0 is the practical choice for s
3432
- Bearer token authentication for Matomo APIs
3533
- Client management UI with create, edit, pause/resume, delete, and secret rotation for confidential clients
3634

37-
---
38-
39-
# OAuth Endpoints
35+
## OAuth Endpoints
4036

4137
| Endpoint | Description |
42-
|--------|-------------|
38+
| --- | --- |
4339
| `/index.php?module=OAuth2&action=authorize` | Authorization endpoint |
4440
| `/index.php?module=OAuth2&action=token` | Token endpoint |
4541

@@ -50,11 +46,9 @@ Optional cleaner routes can be added:
5046
/oauth2/token
5147
```
5248

53-
---
49+
## Setup
5450

55-
# Setup
56-
57-
## 1. Create an OAuth Client
51+
### 1. Create an OAuth Client
5852

5953
Navigate to:
6054

@@ -84,9 +78,7 @@ Client Secret: 7fa9c0f81b8b4a12
8478
Redirect URI: https://example-app.com/oauth/callback
8579
```
8680

87-
---
88-
89-
# OAuth Flow Overview
81+
## OAuth Flow Overview
9082

9183
1. Client redirects the user to `/authorize`
9284
2. User logs into Matomo and approves access
@@ -98,11 +90,9 @@ Redirect URI: https://example-app.com/oauth/callback
9890
Authorization: Bearer ACCESS_TOKEN
9991
```
10092

101-
---
102-
103-
# Authorization Code Flow
93+
## Authorization Code Flow
10494

105-
## Step 1Generate PKCE parameters (Public Clients)
95+
### Step 1: Generate PKCE Parameters (Public Clients)
10696

10797
PKCE requires two values:
10898

@@ -122,11 +112,9 @@ Where:
122112
code_challenge = BASE64URL(SHA256(code_verifier))
123113
```
124114

125-
---
115+
### Step 2: Redirect User to Authorization Endpoint
126116

127-
## Step 2 — Redirect user to Authorization Endpoint
128-
129-
### PKCE Example (Public Client)
117+
#### PKCE Example (Public Client)
130118

131119
```
132120
https://matomo.example.com/index.php?module=OAuth2&action=authorize
@@ -139,7 +127,7 @@ https://matomo.example.com/index.php?module=OAuth2&action=authorize
139127
&code_challenge_method=S256
140128
```
141129

142-
### Confidential Client Example
130+
#### Confidential Client Example
143131

144132
```
145133
https://matomo.example.com/index.php?module=OAuth2&action=authorize
@@ -162,13 +150,11 @@ Matomo will redirect back:
162150
https://example-app.com/oauth/callback?code=AUTHORIZATION_CODE&state=abc123
163151
```
164152

165-
---
166-
167-
# Exchange Authorization Code for Tokens
153+
## Exchange Authorization Code for Tokens
168154

169155
**Note:** The scope should be same as client scope and only one scope is allowed at the moment.
170156

171-
## PKCE Token Request
157+
### PKCE Token Request
172158

173159
```
174160
curl -X POST 'https://matomo.example.com/index.php?module=OAuth2&action=token' \
@@ -180,7 +166,7 @@ curl -X POST 'https://matomo.example.com/index.php?module=OAuth2&action=token' \
180166
-d 'code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk'
181167
```
182168

183-
## Confidential Client Token Request
169+
### Confidential Client Token Request
184170

185171
```
186172
curl -X POST 'https://matomo.example.com/index.php?module=OAuth2&action=token' \
@@ -192,9 +178,7 @@ curl -X POST 'https://matomo.example.com/index.php?module=OAuth2&action=token' \
192178
-d 'code=AUTHORIZATION_CODE'
193179
```
194180

195-
---
196-
197-
# Client Credentials Flow (Server-to-Server)
181+
## Client Credentials Flow (Server-to-Server)
198182

199183
The **Client Credentials grant** is used when a backend service needs to access Matomo APIs **without user interaction**.
200184

@@ -204,7 +188,7 @@ Typical use cases:
204188
- Scheduled data exports
205189
- Backend integrations
206190

207-
## Token Request
191+
### Token Request
208192

209193
```
210194
curl -X POST 'https://matomo.example.com/index.php?module=OAuth2&action=token' \
@@ -215,9 +199,7 @@ curl -X POST 'https://matomo.example.com/index.php?module=OAuth2&action=token' \
215199
-d 'scope=matomo:read'
216200
```
217201

218-
---
219-
220-
# Example Token Response
202+
## Example Token Response
221203

222204
```json
223205
{
@@ -228,9 +210,7 @@ curl -X POST 'https://matomo.example.com/index.php?module=OAuth2&action=token' \
228210
}
229211
```
230212

231-
---
232-
233-
# Refresh Token
213+
## Refresh Token
234214

235215
Use a refresh token to obtain a new access token.
236216

@@ -255,9 +235,7 @@ curl -X POST 'https://matomo.example.com/index.php?module=OAuth2&action=token' \
255235
-d 'refresh_token=def50200a1b9'
256236
```
257237

258-
---
259-
260-
# Calling Matomo APIs with OAuth 2.0
238+
## Calling Matomo APIs with OAuth 2.0
261239

262240
Once an access token is obtained, call Matomo APIs using the **Bearer token**.
263241

@@ -283,9 +261,7 @@ Example response:
283261
}
284262
```
285263

286-
---
287-
288-
# Security Notes
264+
## Security Notes
289265

290266
- Never expose **client secrets** in frontend applications.
291267
- Public clients **must use PKCE**.

docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Documentation
2+
3+
The [OAuth 2.0 User Guide](https://matomo.org/faq/how-to/set-up-oauth-2-0-authentication-for-the-matomo-api/) and the [README.md](https://github.com/matomo-org/plugin-OAuth2/blob/5.x-dev/README.md#features) cover how to get the most out of this plugin.

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "OAuth2",
33
"description": "Provide secure access to the Matomo API using scoped permissions. No static credentials.",
4-
"version": "5.0.0",
4+
"version": "5.0.1",
55
"theme": false,
66
"require": {
77
"php": ">=8.1.0",

0 commit comments

Comments
 (0)