You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/accesstokenmanagement/workers.mdx
+9-11Lines changed: 9 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,17 +17,17 @@ The access tokens need to be requested and [cached](/accesstokenmanagement/advan
17
17
18
18
The actual business code should not need to be aware of this.
19
19
20
-
Have a look for the [Worker project in the samples folder](https://github.com/DuendeSoftware/foss/tree/main/access-token-management/samples/) for running code.
20
+
Take a look at the [`Worker` project in the samples folder](https://github.com/DuendeSoftware/foss/tree/main/access-token-management/samples/) for example code.
21
21
22
-
For more information, also please see the [advanced topic on client credentials](accesstokenmanagement/advanced/client-credentials/).
22
+
For more information, see the [advanced topic on client credentials](accesstokenmanagement/advanced/client-credentials/).
23
23
24
24
25
25
## Usage
26
26
27
-
First, you'll need to add `Duende.AccessTokenManagement` to your solution.
27
+
First, you'll need to add the `Duende.AccessTokenManagement` package to your solution.
28
28
29
-
There are two fundamental ways to interact with token management:
30
-
1.**Automatic** <Badgetext="recommended"/>: You request a http client from the IHTTPClientFactory. This http client automatically requests, optionally renews and attaches the access tokens on each request.
29
+
Next, there are two fundamental ways to interact with token management:
30
+
1.**Automatic** <Badgetext="recommended"/>: You request an `HttpClient`from the `IHttpClientFactory`. This HTTP client automatically requests, optionally renews and attaches the access tokens on each request.
31
31
2.**Manually** <Badgetext="advanced"/>: You request an access token, which you can then use to (for example) authenticate with services. You are responsible for attaching the access token to requests.
You can add the necessary services to the ASP.NET Core service provider by calling `AddClientCredentialsTokenManagement()`. After that you can add one or more named client definitions by calling `AddClient`.
42
42
43
-
:::note
44
-
The way you interact with `Duende.AccessTokenManagement` has changed in version 4.
45
-
:::
46
-
47
43
{/* prettier-ignore */}
48
44
<TabssyncKey="atm-workers">
49
45
{/* prettier-ignore */}
@@ -107,7 +103,7 @@ You can add the necessary services to the ASP.NET Core service provider by calli
107
103
108
104
You can register HTTP clients with the factory that will automatically use the above client definitions to request and use access tokens.
109
105
110
-
The following code registers an HTTP client called `invoices`to automatically use the `invoice.client` definition:
106
+
The following code registers an `HttpClient`called `invoices`which automatically uses the `invoice.client` definition:
111
107
112
108
{/* prettier-ignore */}
113
109
<TabssyncKey="atm-workers">
@@ -191,7 +187,9 @@ The following code registers an HTTP client called `invoices` to automatically u
191
187
}
192
188
```
193
189
194
-
**remark** The clients in the factory have a message handler attached to them that automatically re-tries the request in case of a `401` response code. The request get re-sent with a newly requested access token. If this still results in a `401`, the response is returned to the caller.
190
+
:::note
191
+
The clients in the HTTP client factory have a message handler attached to them that automatically retries the request in case of a `401` response code. The request get resent with a newly requested access token. If this still results in a `401`, the response is returned to the caller.
0 commit comments