AttributeError: 'CloudAdapter' object has no attribute 'sign_out_user'
jelleholtkamp opened this issue · 4 comments
Sample information
- Sample type: Sample
- Sample language: Python
- 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
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.
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.