oAuthPrompt has an invalid value/link on Bot Emulator v4.5.2
See original GitHub issueRelated to: https://github.com/Microsoft/BotFramework-Emulator/issues/1006 https://github.com/Microsoft/BotBuilder-Samples/issues/728
Version
v4.5.2
Describe the bug
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.
To Reproduce
- I registered an Azure AD v2 app to be used for my bot
- I tested the connection settings from the bot and resulted ok
- Tried OAuthCards on MS Teams and resulted ok. (got a valid access token to consume MS Graph Api)
- If I run it on the Emulator: I get: InvalidAuthenticationToken, with CompactToken parsing failed with error code: 80049217. Token received is an authorization token rather than an access token. Also, noticed that the link created on the emulator does not look correct as seen at: https://github.com/Microsoft/BotFramework-Emulator/issues/1006
- Is reproducible with and without “Bypass ngrok for local addresses”
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 }
);
Expected behavior
A valid access token should be received for querying the MS Graph API.
Screenshots
Bot Emulator settings
Additional context
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]
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
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.
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.