I have tried to read the documents from the CosmosDb collection using Primary Key and Primary Read Only Key using the below code.
DocumentClient _documentRUClient = new DocumentClient(new Uri(EndPointURI), PrimaryKey);
DocumentClient _documentRClient = new DocumentClient(new Uri(EndPointURI),
ReadOnly_PrimaryKey);
var result = _documentRUClient.CreateDocumentQuery<T>
(UriFactory.CreateDocumentCollectionUri(DataBaseId, CollectionId),
new FeedOptions() { EnableCrossPartitionQuery = true}).AsEnumerable().ToList();
var result2 = _documentRClient.CreateDocumentQuery<T>
(UriFactory.CreateDocumentCollectionUri(DataBaseId, CollectionId),
new FeedOptions() { EnableCrossPartitionQuery = true}).AsEnumerable().ToList();
The DocumentClient which uses the Primary Key retrieves the documents from Cosmos DB collection without any issues. But the one which uses the Primary Read Only Key throws the following error.
The input authorization token can't serve the request. Please check that the expected payload is built as per the protocol, and check the key being used. Server used the following payload to sign: 'get
sat, 03 mar 2018 06:47:04 gmt
' ActivityId: d57786a0-f7a0-46e9-9375-d5251b81b1e3, Microsoft.Azure.Documents.Common/1.20.108.4, documentdb-dotnet-sdk/1.20.2 Host/64-bit MicrosoftWindowsNT/10.0.16299.0
How to overcome this issue?
