Skip to content

[BotFrameworkAdapter] Process_activity returns HTTP 412 error when exchanging a token #1631

@ceciliaavila

Description

@ceciliaavila

Version

4.12.0

Describe the bug

When performing a token exchange operation between a Host and a Skill, the Host intercepts the oAuthCard sent from the Skill and sends back the Activity with the TokenExchangeInvokeRequest value, returning a response of 412 status and a body of The bot is unable to exchange token. Proceed with regular login..
This issue occurs in BotFrameworkAdapter.exchange_token_from_credentials method when the UserTokenOperation.exchange_async method from BotFramework.Connector gets executed returning the BotFramework.Connector.TokenResponse, followed by a comparison against BotBuilder.Schema.TokenResponse using the isinstance function causing to differ and raise the error (Line#1270).

Another behavior that came up as part of this issue discovered, when the Adapter.process_activity returns the InvokeResponse (Line#512), the body (TokenExchangeInvokeResponse) is not serialized leaving the user to do it as part of the bot.

To Reproduce

Steps to reproduce the behavior:

  1. Use the DotNet Waterfall Host and the Python Waterfall Skill bot samples from the BotFramework-FunctionalTests repo.
  2. Configure the App Registrations required to test Sso. link.
  3. Use WebChat or Emulator for the host.
  4. Select normal delivery mode.
  5. Select Waterfall group.
  6. Select WaterfallSkillBotPython skill.
  7. Select the Sso option.
  8. Login in the Host.
  9. Call the Skill with Sso.
  10. Select Login in the skill.
  11. It will not show the token and ask to SignIn.
  12. The ProcessActivityAsync executed in the SendTokenExchangeInvokeToSkillAsync will return a response of 412 status.

Expected behavior

  • Resolve the correct TokenResponse instance comparing the exchange_async method result against BotFramework.Connector.TokenResponse and not BotBuilder.Schema.TokenResponse.
  • Serialize the InvokeResponse body when the process_activity method gets executed.

Screenshots

Host and Skill Sso communication failure.
image
image

InvokeResponse body isn't serialized.
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or an unintended behavior.needs-triageThe issue has just been created and it has not been reviewed by the team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions