Skip to content
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

Closed
p-nagpal opened this issue Jan 15, 2020 · 4 comments · Fixed by #3544
Closed

[Embed package] Pass userid to token generation logic #2818

p-nagpal opened this issue Jan 15, 2020 · 4 comments · Fixed by #3544
Assignees
Labels
feature-request Azure report label p1 Painful if we don't fix, won't block releasing
Milestone

Comments

@p-nagpal
Copy link
Contributor

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]

@p-nagpal p-nagpal added bug Indicates an unexpected problem or an unintended behavior. Pending Bot Services Required for internal Azure reporting. Do not delete. Do not change color. and removed Bot Services Required for internal Azure reporting. Do not delete. Do not change color. labels Jan 15, 2020
@corinagum corinagum added Enhancement and removed bug Indicates an unexpected problem or an unintended behavior. labels Jan 15, 2020
@tdurnford
Copy link
Contributor

@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>

@tdurnford tdurnford added Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete. labels Jan 15, 2020
@corinagum corinagum added backlog Out of scope for the current iteration but it will be evaluated in a future release. and removed Pending backlog Out of scope for the current iteration but it will be evaluated in a future release. labels Jan 15, 2020
@tdurnford tdurnford reopened this Jan 15, 2020
@tdurnford tdurnford removed Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete. labels Jan 15, 2020
@tdurnford
Copy link
Contributor

Unintentionally closed. Opened by Microsoft internal.

@cwhitten cwhitten added the R9 label Mar 9, 2020
@cwhitten cwhitten added R10 and removed R9 labels Apr 9, 2020
@compulim compulim mentioned this issue May 15, 2020
34 tasks
@compulim compulim removed their assignment Jun 12, 2020
@compulim compulim added this to the R11 milestone Aug 10, 2020
@compulim
Copy link
Contributor

compulim commented Sep 2, 2020

I think @timenick is working on this.

@corinagum corinagum added feature-request Azure report label and removed Enhancement labels Sep 23, 2020
@cwhitten cwhitten added the p1 Painful if we don't fix, won't block releasing label Oct 14, 2020
@cwhitten cwhitten modified the milestones: R11, R12 Oct 23, 2020
@cwhitten
Copy link
Member

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
feature-request Azure report label p1 Painful if we don't fix, won't block releasing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants