Setauthenticatedusercontext shouldn't restrict characters accepted by AppInsights
setauthenticatedusercontext is imposing restrictions to some special characters, on it's parameters, in particular the vertical bar (as per documentation, that are accepted by AI.
For example, I'm currently working on a scenario where we're using auth0, auth0 includes a vertical bar in their id (details can be found here), this creates a consistency problem between data captured in different systems. In our case we have an API built with .Net Core and frontend with React, while in the API we have been capturing this information without problems, we're now facing having to have to go and change it because of this restriction added on top of the core AI.
[Edited] Currently the alternative is to set the properties directly to the User.
appInsights.context.user.authenticatedId = currentUser.id;
appInsights.context.user.accountId = currentUser.orgId;
I would like to propose to remove any restriction that is not added by AI itself.
Tagging as an enhancement as this has been documented this way for a while.
Simplistically, the approach would be for the SDK to encode / decode the documented characters when reading / writing from the cookie and/or local/session storage.
The reason for the exclusion of "|" is because the SDK encodes multiple fields into the cookie using this as the separator.