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

AttributeError: 'CloudAdapter' object has no attribute 'sign_out_user' #2103

Closed
Tracked by #1658
jelleholtkamp opened this issue Apr 11, 2024 · 4 comments
Closed
Tracked by #1658
Labels
bug Indicates an unexpected problem or an unintended behavior. NEXT P1 Painful if we don't fix, won't block releasing

Comments

@jelleholtkamp
Copy link

Sample information

  1. Sample type: Sample
  2. Sample language: Python
  3. Sample name: 18: Bot Authentication

Describe the bug

I run into an error when trying to logout. Sign-in is succesful as the bot does return my token. I am following this

 [on_turn_error] unhandled error: 'CloudAdapter' object has no attribute 'sign_out_user'
Traceback (most recent call last):
  File "***", line 174, in run_pipeline
    return await self._middleware.receive_activity_with_status(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "***", line 69, in receive_activity_with_status
    return await self.receive_activity_internal(context, callback)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "***", line 79, in receive_activity_internal
    return await callback(context)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "***", line 30, in on_turn
    await super().on_turn(turn_context)
  File "***", line 70, in on_turn
    await self.on_message_activity(turn_context)
  File "***", line 37, in on_message_activity
    await DialogHelper.run_dialog(
  File "***", line 19, in run_dialog
    await dialog_context.begin_dialog(dialog.id)
  File "***", line 121, in begin_dialog   
    return await dialog.begin_dialog(self, options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "***", line 67, in begin_dialog  
    turn_result = await self.on_begin_dialog(inner_dc, options)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "***", line 16, in on_begin_dialog
    result = await self._interrupt(inner_dc)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "***", line 32, in _interrupt
    await bot_adapter.sign_out_user(inner_dc.context, self.connection_name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'CloudAdapter' object has no attribute 'sign_out_user'

To Reproduce

Steps to reproduce the behavior:
I followed the BotBuilder sample readme for this authentication which refers to the Add authentication to a bot guide. I'm pretty sure I followed all the steps, since authentication does work and I the bot returns my token when asked. It's just that the logout command is not working.

Expected behavior

The session gets logged out

@jelleholtkamp jelleholtkamp added bug Indicates an unexpected problem or an unintended behavior. needs-triage The issue has just been created and it has not been reviewed by the team. labels Apr 11, 2024
@joshua-dixidata
Copy link

I've been pulling my hair out at this as well for the past week! I couldn't get SSO examples working in Python, so moved into this MSGraph Auth, and while it logs in it won't log out.

I got to the point of determining its because the main app.py has switch from using the BotFrameworkAdapter to the CloudAdapter but don't think the logout.py has been updated to handle this update (as CloudAdapter has no definition for sign_out_user()).

I'm debating today on trying to roll back the packages instead of using the latest 4.14.8, as one of the older releases may resolve this but I'm not hopeful.

@tracyboehrer tracyboehrer transferred this issue from microsoft/BotBuilder-Samples Apr 30, 2024
@tracyboehrer tracyboehrer added P1 Painful if we don't fix, won't block releasing NEXT and removed needs-triage The issue has just been created and it has not been reviewed by the team. labels Apr 30, 2024
@tracyboehrer
Copy link
Member

tracyboehrer commented May 17, 2024

Correction notes:

As a start, the samples LogoutDialog._interrupt should match the DotNet LogoutDialog.InterruptAsync.

UserTokenClient can be retrieved via:

user_token_client: UserTokenClient = inner_dc.context.turn_state.get(
            UserTokenClient.__name__, None
        )

This needs to be reviewed in Python SDK though, as it pertains to UserTokenClient being set in TurnState.

@hristochr
Copy link

I am facing the same issue:

 await bot_adapter.sign_out_user(inner_dc.context, self.connection_name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'CloudAdapter' object has no attribute 'sign_out_user'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or an unintended behavior. NEXT P1 Painful if we don't fix, won't block releasing
Projects
None yet
Development

No branches or pull requests

4 participants