Skip to content

Commit 0ded9a3

Browse files
Updates docs
1 parent 3367db0 commit 0ded9a3

9 files changed

Lines changed: 61 additions & 34 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
/docs/changelog.md
1313
/docs/changelog-*.md
1414
/docs/cache/
15-
/docs/*/cache/
15+
/docs/*/cache/
16+
.codex

docs/5.x/authentication-in-depth.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ There are different ways a user can authenticate in Matomo:
99
* Using username / password and the regular login form.
1010
* The [logme](https://matomo.org/faq/how-to/faq_30/) feature can be used to log someone in using username and password in the URL.
1111
* Using a `token_auth` URL parameter for our HTTP API's and widgets.
12-
* Using OAuth2 bearer tokens for external applications when the OAuth2 plugin is installed.
12+
* Using OAuth 2.0 bearer tokens for external applications when the OAuth 2.0 plugin is installed.
1313

1414
## Username and password login
1515

@@ -65,13 +65,13 @@ When there is a request and we can use a session, then Matomo [checks first if t
6565
* When a `token_auth` parameter is set by us, then we usually POST the token_auth. This is for security reasons so the token_auth won't appear in server logs. Otherwise a sysadmin could see the token in the logs and do all sort of actions on behalf of another user.
6666
* Remember that users should not share the token_auth as it is the same as them sharing their username/password.
6767

68-
## OAuth2
68+
## OAuth 2.0
6969

70-
If the [OAuth2](/guides/oauth2) plugin is installed, external applications can authenticate against Matomo using OAuth2 access tokens.
70+
If the [OAuth 2.0](/guides/oauth2) plugin is installed, external applications can authenticate against Matomo using OAuth 2.0 access tokens.
7171

72-
This is mainly useful when integrating third-party or custom applications that should not receive a long-lived `token_auth`. In that case the application first obtains an access token through the plugin's OAuth2 endpoints and then sends that token as a bearer token when calling supported Matomo APIs.
72+
This is mainly useful when integrating third-party or custom applications that should not receive a long-lived `token_auth`. In that case the application first obtains an access token through the plugin's OAuth 2.0 endpoints and then sends that token as a bearer token when calling supported Matomo APIs.
7373

74-
Depending on the application type, you would typically use either the Authorization Code flow with PKCE or the Client Credentials flow. For the integration flow and request examples, see the [OAuth2 guides](/guides/oauth2).
74+
Depending on the application type, you would typically use either the Authorization Code flow with PKCE or the Client Credentials flow. For the integration flow and request examples, see the [OAuth 2.0 guides](/guides/oauth2).
7575

7676
## Alternative login plugins
7777

docs/5.x/oauth2.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ subGuides:
77
- oauth2/api-usage
88
- oauth2/faq
99
---
10-
# OAuth2
10+
# OAuth 2.0
1111

12-
This section contains guides that will help you authenticate external applications against Matomo using OAuth2.
12+
This section contains guides that will help you authenticate external applications against Matomo using OAuth 2.0.
1313

14-
**OAuth2** is a plugin for Matomo that adds a first-party OAuth2 Authorization Server. It allows external applications to access Matomo APIs using OAuth2 access tokens instead of sending a `token_auth`.
14+
The **OAuth 2.0** plugin adds a first-party OAuth 2.0 Authorization Server to Matomo. It allows external applications to access Matomo APIs using OAuth 2.0 access tokens instead of sending a `token_auth`.
1515

16-
The plugin supports the **Authorization Code** flow with **PKCE**, **Client Credentials**, and **Refresh Token** support. OAuth clients can be managed in Matomo under **Administration => Platform => OAuth2**. In Matomo Cloud, this screen is available under **Administration => Export => OAuth2**.
16+
The plugin supports the **Authorization Code** flow with **PKCE**, **Client Credentials**, and **Refresh Token** support. Applications authenticate with bearer tokens and can be limited to the scopes granted to each OAuth client.
17+
18+
OAuth 2.0 clients can be managed in Matomo under **Administration => Platform => OAuth 2.0**. In Matomo Cloud, this screen is available under **Administration => Export => OAuth 2.0**. From there you can create, edit, pause, resume, or delete clients, and rotate secrets for confidential clients.
1719

1820
If you are looking for general API authentication details, also see [Authentication In Depth](/guides/authentication-in-depth) and [Querying the Reporting API](/guides/querying-the-reporting-api).

docs/5.x/oauth2/api-usage.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
category: Integrate
3-
title: OAuth2 API Usage
3+
title: OAuth 2.0 API Usage
44
---
5-
# Calling Matomo APIs with OAuth2
5+
# Calling Matomo APIs with OAuth 2.0
66

77
Once your application has obtained an access token, it can call Matomo APIs using the `Authorization` header.
88

@@ -23,16 +23,16 @@ curl 'https://matomo.example.com/index.php' \
2323
-d 'format=json'
2424
```
2525

26-
## OAuth2 compared to `token_auth`
26+
## OAuth 2.0 compared to `token_auth`
2727

2828
By default, many Matomo API guides use `token_auth` examples because `token_auth` is available in every Matomo installation.
2929

30-
When the OAuth2 plugin is installed, external applications can use OAuth2 bearer tokens instead. This avoids sharing a long-lived auth token with the external application and lets you choose a grant type that matches the integration.
30+
When the OAuth 2.0 plugin is installed, external applications can use OAuth 2.0 bearer tokens instead. This avoids sharing a long-lived auth token with the external application, lets you choose a grant type that matches the integration, and makes it easier to limit and revoke access without affecting other applications.
3131

3232
If you are integrating a backend service with no user interaction, the Client Credentials flow is usually the best fit. If your application acts on behalf of a user, use the Authorization Code flow.
3333

3434
## Notes
3535

3636
* Use HTTPS whenever you send access tokens.
3737
* The plugin currently allows only one scope per request.
38-
* Keep using the standard `token_auth` flow in integrations where the OAuth2 plugin is not installed.
38+
* Keep using the standard `token_auth` flow in integrations where the OAuth 2.0 plugin is not installed.

docs/5.x/oauth2/authorization-code.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
category: Integrate
3-
title: OAuth2 Authorization Code Flow
3+
title: OAuth 2.0 Authorization Code Flow
44
---
5-
# OAuth2 Authorization Code Flow
5+
# OAuth 2.0 Authorization Code Flow
66

77
Use the Authorization Code flow when your application acts on behalf of a Matomo user.
88

@@ -11,7 +11,7 @@ Use the Authorization Code flow when your application acts on behalf of a Matomo
1111
The Authorization Code flow works like this:
1212

1313
1. Your application redirects the user to the Matomo authorization endpoint.
14-
2. The user logs in and approves access.
14+
2. The user logs in, reviews the requested permissions, and approves access.
1515
3. Matomo redirects back with an authorization `code`.
1616
4. Your application exchanges the code for an access token.
1717
5. Your application calls Matomo APIs using `Authorization: Bearer ACCESS_TOKEN`.
@@ -59,7 +59,13 @@ https://matomo.example.com/index.php?module=OAuth2&action=authorize
5959
&state=abc123
6060
```
6161

62-
After the user approves access, Matomo redirects back to your application:
62+
The user will:
63+
64+
1. Log in to Matomo.
65+
2. Review the requested permissions.
66+
3. Click **Allow**.
67+
68+
After approval, Matomo redirects back to your application:
6369

6470
```text
6571
https://example-app.com/oauth/callback?code=AUTHORIZATION_CODE&state=abc123
@@ -106,6 +112,8 @@ curl -X POST 'https://matomo.example.com/index.php?module=OAuth2&action=token' \
106112

107113
## Refresh an access token
108114

115+
Use a refresh token to obtain a new access token.
116+
109117
### Public client
110118

111119
```bash
@@ -129,4 +137,4 @@ curl -X POST 'https://matomo.example.com/index.php?module=OAuth2&action=token' \
129137

130138
## What to read next
131139

132-
Once you have an access token, see [Calling Matomo APIs with OAuth2](/guides/oauth2/api-usage).
140+
Once you have an access token, see [Calling Matomo APIs with OAuth 2.0](/guides/oauth2/api-usage).

docs/5.x/oauth2/client-credentials.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
category: Integrate
3-
title: OAuth2 Client Credentials Flow
3+
title: OAuth 2.0 Client Credentials Flow
44
---
5-
# OAuth2 Client Credentials Flow
5+
# OAuth 2.0 Client Credentials Flow
66

77
Use the Client Credentials flow when a backend service needs to access Matomo APIs without user interaction.
88

99
Typical examples include:
1010

1111
* Internal analytics dashboards
12-
* Scheduled exports
12+
* Scheduled data exports
1313
* Backend integrations
1414

1515
## Request an access token
@@ -37,6 +37,6 @@ Depending on your client configuration, a refresh token may also be available th
3737

3838
## When to use this flow
3939

40-
Use this flow only for trusted server-side applications that can keep credentials secret.
40+
Use this flow for trusted server-side applications that need server-to-server access and can keep credentials secret.
4141

4242
If the application needs a user to log in and approve access, use the [Authorization Code flow](/guides/oauth2/authorization-code) instead.

docs/5.x/oauth2/faq.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
category: Integrate
3-
title: OAuth2 Developer FAQ
3+
title: OAuth 2.0 Developer FAQ
44
---
5-
# OAuth2 Developer FAQ
5+
# OAuth 2.0 Developer FAQ
66

77
## Which grant types are supported?
88

@@ -54,6 +54,14 @@ Optional cleaner routes can also be configured:
5454
* `/oauth2/authorize`
5555
* `/oauth2/token`
5656

57+
## When is a client secret shown?
58+
59+
For confidential clients, the client secret is shown in full only when the client is created or when the secret is rotated. After that, the secret is masked in the UI.
60+
61+
## Can I rotate a client secret?
62+
63+
Yes. Confidential clients support secret rotation from the edit screen. Rotate the secret if you need a new value or if the existing one may have been exposed.
64+
5765
## Can I still use `token_auth`?
5866

59-
Yes. The OAuth2 plugin adds an alternative authentication method for external applications. Existing `token_auth` based integrations continue to be relevant for Matomo installations where the plugin is not enabled.
67+
Yes. The OAuth 2.0 plugin adds an alternative authentication method for external applications. Existing `token_auth` based integrations continue to be relevant for Matomo installations where the plugin is not enabled.

docs/5.x/oauth2/setup.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
category: Integrate
3-
title: OAuth2 Setup
3+
title: OAuth 2.0 Setup
44
---
5-
# Setting up OAuth2
5+
# Setting up OAuth 2.0
66

77
In this guide you will learn how to configure an OAuth client so an external application can request access tokens for Matomo.
88

9-
## What the OAuth2 plugin provides
9+
## What the OAuth 2.0 plugin provides
1010

11-
The plugin adds a first-party OAuth2 Authorization Server to Matomo. Once enabled, applications can authenticate against Matomo using bearer tokens instead of sharing a permanent `token_auth`.
11+
The plugin adds a first-party OAuth 2.0 Authorization Server to Matomo. Once enabled, applications can authenticate against Matomo using bearer tokens instead of sharing a permanent `token_auth`.
1212

1313
The plugin supports these grant types:
1414

@@ -25,9 +25,11 @@ The plugin currently supports these scopes:
2525

2626
See the [permissions guide](/guides/permissions) for more information.
2727

28-
## OAuth endpoints
28+
Access tokens are sent as bearer tokens when calling Matomo APIs. The plugin uses RSA keys to sign JWT access tokens.
2929

30-
Matomo exposes these OAuth2 endpoints:
30+
## OAuth 2.0 endpoints
31+
32+
Matomo exposes these OAuth 2.0 endpoints:
3133

3234
| Endpoint | Description |
3335
|--------|-------------|
@@ -57,11 +59,15 @@ Create a client and configure:
5759
* The allowed scopes
5860
* The redirect URI for the Authorization Code flow
5961

62+
From the client list, you can pause or resume a client, open it for editing, or delete it. For confidential clients, secret rotation is available from the edit screen.
63+
6064
You can create either of these client types:
6165

6266
* **Confidential** clients, which use a client secret
6367
* **Public** clients, which do not use a client secret and should use PKCE
6468

69+
Client secrets are shown in full only when a confidential client is created or when its secret is rotated. After that, the secret is masked and you need to rotate it again if you want a new value.
70+
6571
Example client:
6672

6773
```text
@@ -76,6 +82,8 @@ Use a **public** client when your application cannot safely store a client secre
7682

7783
Use a **confidential** client when your application runs on a trusted backend and can safely keep the client secret private.
7884

85+
At the time of writing, the plugin allows only one scope per request and the requested scope needs to match the client configuration.
86+
7987
## What to read next
8088

8189
Once your client is configured, continue with the [Authorization Code guide](/guides/oauth2/authorization-code) or the [Client Credentials guide](/guides/oauth2/client-credentials).

docs/5.x/querying-the-reporting-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ If you want to request data in any language (PHP, Python, Ruby, ASP, C++, Java,
1717
If the API call requires the token_auth and the HTTP request is sent over untrusted networks, we highly advise that you use an encrypted request. Otherwise, your token\_auth is exposed to eavesdroppers. This can be done by using https instead of http.
1818
</div>
1919

20-
If the [OAuth2](/guides/oauth2) plugin is installed, external applications can also authenticate using OAuth2 bearer tokens instead of sending a `token_auth`. The examples below continue to use `token_auth` because it is available in every Matomo installation.
20+
If the [OAuth 2.0](/guides/oauth2) plugin is installed, external applications can also authenticate using OAuth 2.0 bearer tokens instead of sending a `token_auth`. The examples below continue to use `token_auth` because it is available in every Matomo installation.
2121

2222
You can, for example, get the list of countries where most of your visitors in the current month are from. Here is an example in PHP:
2323

0 commit comments

Comments
 (0)