Add sample for user ID and more validation logics #1447
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
If user ID is not specified, default will be
default-user
.Although conversation is identified/partitioned by conversation ID, user state use user ID. That means, multiple conversations with same user ID will share same user state.
In README.md, we didn't spec out how to specify
userID
. This PR will add the documentation and more checks to make sure theuserID
passed is okay:userID
can be specified by props or embedded in Direct Line token.userID
is both specified and embedded, we prefer the embedded one from Direct Line token.userID
must be a string.userID
passed from props cannot prefix withdl_
.dl_
, and this user ID is "forgery-proof". This checks reduces the confusion between a forgery-proof user ID and a non-forgery-proof one.Changelog
Added
README.md
and adding validation logic foruserID
props, in #1447userID
props present and also embedded in Direct Line token, will use the one from Direct Line tokenuserID
props present, they must be string and not prefixed withdl_
, to avoid confusion betweenuserID
props and Direct Line embedded user ID (which is forgery-proof)userID
props does not pass the validation test or not specified, Web Chat will usedefault-user
instead