Skip to content

Commit 820a6a0

Browse files
Merge pull request #298 from kinde-oss/Feat/subscopes
Feat/subscopes
2 parents 0a6f18e + c97ec8e commit 820a6a0

File tree

3 files changed

+40
-6
lines changed

3 files changed

+40
-6
lines changed

src/content/docs/developer-tools/kinde-api/about-m2m-scopes.mdx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,39 @@ app_context:
1414
s: apis
1515
---
1616

17-
The Kinde management API uses JSON Web Tokens (JWTs) to authenticate requests. The token’s scopes claim indicates which endpoints can be accessed when calling the management API.
17+
The Kinde management API uses JSON Web Tokens (JWTs) to authenticate requests. The token’s scopes claim indicates which endpoints can be accessed when calling the API.
1818

1919
## Example scopes
2020

2121
- `read:users` for fetching user details.
2222
- `write:users` for modifying user details.
2323
- `read:roles` or `write:roles` for managing roles.
2424

25-
You can select scopes when you authorize a new application or you can add scopes to an existing application. We recommend adding as few scopes as you need, to maintain API security.
25+
You can select scopes when you authorize a new application or you can add scopes to an existing application. We recommend adding as few scopes as you need, to maintain API security.
2626

27-
## Change or add scopes to an application accessing the Kinde Management API
27+
## Request scopes in the body of an access token request
28+
29+
By default token requests for an authorized application will return all the scopes enabled below. You can also optionally ask for a subset of enabled scopes to be returned by including them in the body of the access token request. You might do this to add more security to access requests, or because you want your users to be very specific about scopes in their requests.
30+
31+
Example request
32+
33+
```
34+
curl --request POST \
35+
--url 'https://<your_subdomain>.kinde.com/oauth2/token' \
36+
--header 'content-type: application/x-www-form-urlencoded' \
37+
--data grant_type=client_credentials \
38+
--data 'client_id=<your_m2m_client_id>' \
39+
--data 'client_secret=<your_m2m_client_secret>' \
40+
--data 'audience=https://<your_subdomain>.kinde.com/api'\
41+
--data 'scope=read:users update:users'
42+
```
43+
44+
## Add or modify scopes for accessing the Kinde Management API
2845

2946
Follow this procedure if you already have an application and you experience a scope error, if you want to add scopes for an application, or remove scopes to tighten security.
3047

3148
1. Go to **Settings > Applications** and select the relevant M2M application.
3249
2. On the left, select **APIs**.
3350
3. Select the three dots next to the Kinde management API, then choose **Manage scopes**.
3451
4. Select the scopes you want to include in the token. For maximum security only enable the minimum scopes you require.
35-
5. Select **Save**. The scopes will now be included in the token. You do not need to also send them in the token request.
52+
5. Select **Save**.

src/content/docs/developer-tools/your-apis/custom-api-scopes.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,20 @@ Take care deleting scopes. If a scope is in use, it can cause breaking changes f
6868
4. Select the dots menu (far right) and select:
6969
- **Edit scope.** You can only change the scope description. Select **Save**.
7070
- **Delete scope**. Confirm that you want to delete and select **Delete scope**.
71+
72+
## Request a subset of scopes for an authorized application
73+
74+
By default token requests for an authorized application will return all the scopes enabled in the section above. However, you can also optionally ask for a subset of enabled scopes to be returned by including them in the body of the access token request. You might do this to add more security to access requests for your API, or because you want your users to be very specific in their requests.
75+
76+
Example request
77+
78+
```
79+
curl --request POST \
80+
--url 'https://<your_subdomain>.kinde.com/oauth2/token' \
81+
--header 'content-type: application/x-www-form-urlencoded' \
82+
--data grant_type=client_credentials \
83+
--data 'client_id=<your_m2m_client_id>' \
84+
--data 'client_secret=<your_m2m_client_secret>' \
85+
--data 'audience=<your_api_audience>\
86+
--data 'scope=join:competitions update:competitions'
87+
```

src/content/docs/developer-tools/your-apis/test-token-from-kinde.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
page_id: be39d3bb-a83d-4d21-8941-8f1c8363c3bb
3-
title: Get a user access token to test your APIs (Fast method)
3+
title: Get a M2M token to test your APIs
44
sidebar:
55
order: 2
66
relatedArticles:
@@ -10,7 +10,7 @@ relatedArticles:
1010

1111
Kinde lets you quickly generate a test token for testing your APIs with Kinde. This can save you time generating a token via Postman or other service.
1212

13-
This process assumes you have [registered](/developer-tools/your-apis/register-manage-apis/) your API with Kinde, and have [authorized an application](/developer-tools/your-apis/register-manage-apis/#authorize-or-revoke-authorization-of-an-app-from-the-api) to access it.
13+
This process assumes you have [registered](/developer-tools/your-apis/register-manage-apis/) your API with Kinde, and have [authorized an M2M application](/developer-tools/your-apis/register-manage-apis/#authorize-or-revoke-authorization-of-an-app-from-the-api) to access it.
1414

1515
1. In Kinde, go to **Settings > APIs**.
1616
2. Select **View details** on your API.

0 commit comments

Comments
 (0)