-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Embed package] Pass userid to token generation logic #2818
Labels
Milestone
Comments
@p-nagpal You can currently generate a DirectLine token that includes a user id and a username and pass that to the iFrame as a url parameter. Take a look at the Generating a DirectLine Token and Embedded Web Chat documentation for more details. <!DOCTYPE html>
<html lang="en-US">
<head>
<title>Web Chat: iFrame</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
html,
body {
height: 100%;
}
body {
margin: 0;
}
</style>
</head>
<body>
<script>
(async function() {
// Note, for the simplicity of this example, we are generating the Direct Line token on client side;
// however, this is not a recommended practice and you should create and manage your tokens from the server.
// You should never put the Direct Line secret in the browser or client app.
const secret = '<DIRECT_LINE_SECRET>';
const res = await fetch('https://directline.botframework.com/v3/directline/tokens/generate', {
body: JSON.stringify({ user: { id: 'dl_user_id', name: 'username' } }),
headers: {
Authorization: `Bearer ${secret}`,
'Content-type': 'application/json'
},
method: 'POST'
});
const { token } = await res.json();
const iframe = document.createElement('iframe');
iframe.src = `https://webchat.botframework.com/embed/<YOUR_BOT_ID>?t=${token}`;
iframe.style = 'min-width: 400px; width: 100%; min-height: 500px';
document.body.appendChild(iframe);
})().catch(err => console.error(err));
</script>
</body>
</html> |
Unintentionally closed. Opened by Microsoft internal. |
I think @timenick is working on this. |
This was referenced Oct 16, 2020
Moving to R12 as the PR is in draft state and incomplete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Version
4.7.1
Describe the bug
The logic in Embed package should pass in userid (included in query parameters) to create conversation/token generation. Today the userid and username is passed as query parameter but not included in the token.
Could you help to enhance embed\src to include this?
[Bug]
The text was updated successfully, but these errors were encountered: