Related to:
https://github.com/Microsoft/BotFramework-Emulator/issues/1006
https://github.com/Microsoft/BotBuilder-Samples/issues/728
v4.5.2
Invoking OAuthCards on Bot Emulator results in InvalidAuthenticationToken, with CompactToken parsing failed with error code: 80049217.
OAuthCard Connection String has been tested on Azure and results ok.
Source Code being used
// Create a DialogSet that contains the OAuthPrompt.
this.dialogSet = new DialogSet(this.dialogState);
// Add an OAuthPrompt with the connection name as specified on the Bot's settings blade in Azure.
//this.dialogSet.add(this.prompt(process.env.OAUTH_CARDS_CONNECTION_STRING));
this.oauthPrompt = new OAuthPrompt(LOGIN_PROMPT,
{
connectionName: process.env.OAUTH_CARDS_CONNECTION_STRING,
text: 'Please login into SharePoint',
title: 'Login',
timeout: 10000
});
this.dialogSet.add(this.oauthPrompt);
...
await step.context.sendActivity(Your token is: ${ tokenResponse.token });
A valid access token should be received for querying the MS Graph API.

Bot Emulator settings

Same source code works fine in MS Teams. It returns a valid Bearer Token.
My only suspicion is that I do not put MsAppPassword in .ENV
[bug]
Hi @textminer ,
Thanks for the detailed issue report!
From the looks of your screenshots it appears that the Emulator has fallen back to providing you with an emulated token and not a genuine token from the Bot Framework token service.
This happens when the Emulator fails to generate a valid OAuth signin link. This can be caused by several things, but usually is due to an incorrect path to ngrok in the settings page, but it looks like you have that configured.
I currently have a pull request (#1745) out that will add error logging to this flow, so the Emulator will tell you why it is falling back to generating an emulated token. Once this PR gets merged in (hopefully by the end of day), we will release a new nightly version of the Emulator tonight with the change.
It would be great if you could use that nightly version (will be available here once it has been released) and try this same scenario so we can see the error message that is causing this.
Also, I believe you need to have the correct Microsoft App ID & Password passed into your bot code as well as into the Emulator when connecting to your bot.
Hi @tonyanziano,
I made sure the Microsoft App ID & Password are correct doing a POST using POSTMAN as explained at https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-authentication?view=azure-bot-service-4.0
I tried with and without putting those keys in the .env file.
Thanks for putting hands on it. I'll let you know the outcomes with the new nightly version.
@textminer the PR has been merged in, so the nightly should become available shortly after 10 PM PST tonight (Usually around 10:30 PM PST).
Hi, I installed the night built, and as seen in the pic below I had an Unauthorized issue between the Emulator and the Bot. Now the Emulator shows it.

The solution was to recreate the .bot file config that the Emulator uses and it started being authorized and getting a valid access token. I must have been reusing the same .bot file in the emulator created with previous versions...
Thanks all for your support.
Awesome! Glad you got it figured out.