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

Fixed a bug where OAuth cards were opening the file explorer if ngrok… #2155

Merged
merged 3 commits into from
Jun 9, 2020

Conversation

tonyanziano
Copy link
Contributor

… was not configured.

Fixes #2130

===

The bug:

  • Clicking the sign-in button on an OAuth card would open the OS file explorer if ngrok was not configured in the app settings at the time the card was generated (see issue for reference video)

The cause:

  • Whenever the bot sends an Adaptive Card to the user, the Emulator first scans it to see if it is an OAuth card, and if it is, we go ahead and use the current ngrok URL to construct a sign-in link to append to the card before forwarding it to Web Chat and the user
  • However, if ngrok is not configured and the Emulator cannot start an instance of ngrok, then receiving a token from the token service will be impossible, so we should instead generate a fake sign-in link that the Emulator will interpret and know to send a fake, emulated token
  • The Emulator was detecting that there was no ngrok, but it was not generating the fake sign-in link to complete the delivery of the emulated token to the bot. It was just propagating the error the log panel and stating that it was falling back to the emulated token:

ngrok-err

The fix:

  • Upon detecting that ngrok is not configured, the Emulator will now properly construct the fake sign-in link before propagating the error up to the log panel

Extra:

  • Got rid of some related, unused code

===

Video of fix in action

@coveralls
Copy link

coveralls commented Jun 6, 2020

Coverage Status

Coverage decreased (-0.02%) to 67.903% when pulling 6acd6fe on toanzian/oauth-cards into a5be796 on master.

@tonyanziano
Copy link
Contributor Author

@tonyanziano tonyanziano merged commit c5937fc into master Jun 9, 2020
@tonyanziano tonyanziano deleted the toanzian/oauth-cards branch June 9, 2020 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clicking "Sign In" on an OAuth Card opens the file explorer
3 participants