Skip to content

Commit 0102cf2

Browse files
committed
Configuring ATM for gRPC clients
1 parent 8bc0acf commit 0102cf2

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)