question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure Gov WebChat: DirectLine Enhanced Authentication resulted in magic number authentication

See original GitHub issue

Screenshots

Bot channel registration directline settings image

Load bot from trusted URL image

OAuthPrompt card displayed in webchat image

Error in F12 after clicking on the button image

A new tab for magic code was opened image

Version

4.7.1 through NPM

Describe the bug

v4.7.2 .NET Core Bot is hosted in Microsoft Azure Government (MAG). DirectLine Enhanced Authentication does not work in trusted urls and resulted in magic code authentication instead of the expected behavior (new tab open and close automatically without user having to do manual input). F12 on browser displayed the following error

GET https://directline.botframework.azure.us/v3/directline/session/getsessionid 500

The error

Steps to reproduce

  1. Setup a sample auth bot in Azure MAG.

  2. Use the following values in appsettings.json { "BotEnv": "usgovprd", "ChannelService": "https://botframework.azure.us", "MicrosoftAppId": "[Omited]", "MicrosoftAppPassword": "[Omitted]", "ScmType": "None", "isAzureGovernment": true, "OAuthConnectionName": "aadv2" }

  3. Use the following codes before prompting the OAuthPrompt card. OAuthClientConfig.OAuthEndpoint = "https://token.botframework.azure.us"; MicrosoftAppCredentials.TrustServiceUrl("https://token.botframework.azure.us");

  4. Configure directline channel on the bot channel registration. Enable Enhanced Authentication and add a trusted url.

  5. Configure an OAuth authentication connection with AADV2 as provider. The service principal used is from a GCC tenant.

  6. Get a token from https://directline.botframework.azure.us/v3/directline/tokens/generate with a user id ‘dl_[new guid]’

  7. Add a webchat control to the home page of the trusted url with code similar to below

           let directLineConnection = window.WebChat.createDirectLine({
               token: accessToken,
               domain: 'https://directline.botframework.azure.us/v3/directline' 
           });
    
           .....
    
           window.WebChat.renderWebChat({
               directLine: directLineConnection,
               store,
               styleOptions
           }, document.getElementById('webchat'));
    
  8. Go to the trusted url to launch the homepage and webchat.

  9. Interact with the bot to get an OAuthPrompt card back.

  10. Click on the OAuthPrompt card.

  11. Magic code authentication screen is displayed instead of the expected behavior

Expected behavior

The OAuthPrompt card should open up a new browser tab, close it, and auth token is received automatically in webchat as on the Azure commercial side.

Note

The magic code can be used to successfully authenticate the user.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
AngryVirginiancommented, Mar 16, 2020

@p-nagpal I confirm that the issue has been resolved in both Arlington and Fairfax datacenters. Please proceed with closing the ticket. Thank you fort he quick responses.

0reactions
AngryVirginiancommented, Mar 14, 2020

@p-nagpal you are right. My mistake. I turned off Enhanced Authentication during testing. It is working in the Fairfax datacenter now. I will test the other us gov bot that is in the Arlington datacenter on Monday.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Direct Line enhanced authentication - Bot Service
Enable the Direct Line channel's enhanced authentication option to allow the Azure Bot Service to further detect and reject any user ID change. ......
Read more >
Using WebChat with Azure Bot Service's Authentication
This blog covers how to use Web Chat with the Azure Bot Service's built-in authentication capability to authenticate chat users with various ...
Read more >
Can't get conversationUpdate activity with the Enhanced ...
You aren't doing anything wrong. This is a known issue in the DirectLine Connector Service, and the development team is currently working to ......
Read more >
PWq - River Thames Conditions
Cinemax bangalore contact number, Darksiders deathinitive trophies. ... Keshod accident, Mcw library login, Flowers and songs of sorrow poem, ...
Read more >
Untitled
Adriely parizi, American hospital supply jobs, Totempower, The visualizer login! Devita band! Modern fiction virginia woolf ppt, Pracownia pod baranami ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found