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.

oAuthPrompt has an invalid value/link on Bot Emulator v4.5.2

See original GitHub issue

Related 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

  1. I registered an Azure AD v2 app to be used for my bot
  2. I tested the connection settings from the bot and resulted ok
  3. Tried OAuthCards on MS Teams and resulted ok. (got a valid access token to consume MS Graph Api)
  4. 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
  1. 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

imagen

Bot Emulator settings imagen

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:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
textminercommented, Aug 21, 2019

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. imagen 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.

1reaction
textminercommented, Aug 20, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test and debug with the Emulator - Azure Bot Service
Learn how to inspect, test, and debug bots using the Bot Framework Emulator desktop application.
Read more >
Testing In Bot Framework Emulator Giving Invalid Token
This is resulting in my conversations not being able to get past the OAuth prompt stage because my token is never valid. This...
Read more >
Step by Step: Configure Bot to Work in Teams and with ...
This blog post is a step-by-step instruction on how to create a Bot from scratch using Microsoft Bot Framework v4, configure it to...
Read more >
Testing authentication to your bot using the Bot Framework ...
In this blog post, we'll show you how to test bot authentication capabilities from Azure Bot Service using the Bot Framework Emulator.
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