dapr / dapr/dotnet-sdk

SaveBulkStateAsync does not respect DAPR_API_TOKEN

Open
#1,282 0 comments 0 reactions 0 assignees View on GitHub
kind/bug
Dominant language
C#
Stars
1.2k
Forks
378
Avg merge
1d 22h
Merged PRs (30d)
5

Description

## Expected Behavior
`SaveBulkStateAsync` respects `DAPR_API_TOKEN` to authenticate to dapr sidecar.

## Actual Behavior

`SaveBulkStateAsync` fails with an `Unauthorized` error when the dapr sidecar is running with API token authentication even when the token is passed to the client and works for other calls e.g. `SaveStateAsync`.

```
Unhandled exception. Dapr.DaprException: State operation failed: the Dapr endpoint indicated a failure. See InnerException for details.
---> Grpc.Core.RpcException: Status(StatusCode="Unauthenticated", Detail="Unauthorized")
at Dapr.Client.DaprClientGrpc.SaveBulkStateAsync[TValue](String storeName, IReadOnlyList`1 items, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
```

## Steps to Reproduce the Problem
Run the [bulk state example](https://github.com/dapr/dotnet-sdk/blob/master/examples/Client/StateManagement/BulkStateExample.cs) against a Dapr sidecar with authentication enabled.

## Release Note
RELEASE NOTE: **FIX** Bug not using api token for bulk save state requests

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.