Skip to content

Commit 8866802

Browse files
authored
Merge pull request #826 from DuendeSoftware/wca/atm-grpc
Configuring ATM for gRPC clients
2 parents 5a53ae7 + 0102cf2 commit 8866802

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/content/docs/accesstokenmanagement/web-apps.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,20 @@ public async Task<IActionResult> CallApi([FromServices] InvoiceClient client)
176176
}
177177
```
178178

179+
### gRPC Support
180+
If you are using gRPC, you can also use the `AddClientAccessTokenHandler` and `AddUserAccessTokenHandler` methods when
181+
registering typed gRPC clients:
182+
183+
```csharp
184+
// Program.cs
185+
builder.Services.AddGrpcClient<Greeter.GreeterClient>(o =>
186+
{
187+
o.Address = new Uri("https://localhost:5001");
188+
})
189+
.AddUserAccessTokenHandler();
190+
// or .AddClientAccessTokenHandler(); when using client credentials
191+
```
192+
179193
## Manually Request Access Tokens
180194

181195
If you want to use access tokens differently or have more advanced needs which the automatic option doesn't cover, then you can also manually request user access tokens.

0 commit comments

Comments
 (0)