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

App ID and password not working on Emulator Core #839

Closed
ckkashyap opened this issue Sep 10, 2018 · 1 comment
Closed

App ID and password not working on Emulator Core #839

ckkashyap opened this issue Sep 10, 2018 · 1 comment
Assignees
Labels
Bug Your classic code defect

Comments

@ckkashyap
Copy link

ckkashyap commented Sep 10, 2018

This commit broke it, e915ec1#diff-c02a923b1d3cf43295b9353b9c20e2fe.

Repro

  1. Run a bot with MSA ID and password
  2. Run the Emulator CLI with the same ID and password
  3. Run Web Chat, pointing to the Emulator Core
  4. Send "hi"

Expected

It should works, the bot should response

Actual

When Emulator Core verify the signature from POST /directline/conversations/…/activities, the Emulator Core jsonwebtoken think it is wrong and return 401 back to the bot.

@ckkashyap ckkashyap added the Bug Your classic code defect label Sep 10, 2018
@ckkashyap ckkashyap self-assigned this Sep 10, 2018
@ckkashyap
Copy link
Author

There are multiple variants of Base64 encoding, list at https://en.wikipedia.org/wiki/Base64.

In the original code, base64url.toBase64(key.n) is just translating Base64Url into Base64. It is not encoding, just turning +/ into -_, and changing the padding =.

In @justinwilaby code, Buffer.from(key.n).toString('base64') is encoding a Base64 into an extra Base64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Your classic code defect
Projects
None yet
Development

No branches or pull requests

2 participants