Is it ok to store _rid in a cookie for remember me feature

ruast 1 Reputation point

For id i am using emailid but i do not want to store email id in cookie.

For remember me feature on my website's login i want to store a GUID + _rid in the user's browser cookies. I believe _rid is unique across the collection?
and store the corresponding GUID in the document of that user in Cosmos

Then lookup the document using _rid and if GUID matches then login the user.
Is it safe to store the _rid in the user's browser in plaintext?

Also , is it possible to retrieve a document by it's _rid or _self?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,437 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 27,012 Reputation points Microsoft Employee

    Hi, @ruast Thanks for posting your query in the Microsoft Q&A forum
    I understand that you don't want to store an email id in a cookie and you want to retrieve a document by its _rid or _self.
    If you’re trying to read a single document using _rid or _self you would have to use a query that is going to be more expensive with more latency than if you had just used primary key and id with ReadItemAsync().

    There is no faster, cheaper, or easier way to retrieve a single item of data than by its primary key and id. _rid and _self are internal fields. you should not be taking a dependency on them anyway.

    If you don’t want to store email in a cookie then store it in another property and use a GUID or some other unique string to store in a cookie.