Skip to content

AsyncOAuthSettings uses CallbackOptions instead of AsyncCallbackOptions #210

Description

@jwelch92

Reproducible in:

pip freeze | grep slack
python --version
sw_vers && uname -v # or `ver`

The slack_bolt version

slack-bolt==1.1.4
slack-sdk==3.1.1

Python runtime version

Python 3.6.9

OS info

Darwin

Expected

AsyncOAuthSettings has a AsyncCallbackOptions instead of CallbackOptions. I'm fully on the async version of the SDK with strict type checking and this discrepancy made it harder to customize the success/failure handlers for OAuth flow.

callback_options: Optional[CallbackOptions] = None

should be

callback_options: Optional[AsyncCallbackOptions] = None

I ended up having to work around this by subclassing AsyncOAuthFlow and adding AsyncCallbackOptions to the constructor.

class MyAsyncOAuthFlow(AsyncOAuthFlow):
    def __init__(
        self,
        *,
        client: Optional[AsyncWebClient] = None,
        logger: Optional[Logger] = None,
        settings: AsyncOAuthSettings,
        callback_options: Optional[AsyncCallbackOptions] = None,
    ):
        super().__init__(client=client, logger=logger, settings=settings)
        if callback_options is not None:
            self.success_handler = callback_options.success  # type: ignore because mypy
            self.failure_handler = callback_options.failure  # type: ignore

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Activity

  1. added this to the 1.2.2 milestone on Jan 15, 2021
  2. seratch commented on Jan 15, 2021

    @seratch
    Contributor

    Thanks for pointing this out! You are right (again): https://github.com/slackapi/bolt-python/blob/v1.2.1/slack_bolt/oauth/async_oauth_settings.py#L69

    Although this project runs pytype for validating type hints, it seems the checker did not detect this issue. As with #208, this issue will be fixed shortly.

  3. jwelch92 commented on Jan 15, 2021

    @jwelch92
    Author

    I'd fix this myself but I need to figure out CLA first 😄 Thanks for taking a look @seratch!

    I'm using mypy==0.790 for type checking FWIW.

  4. added a commit that references this issue on Jan 18, 2021
    90bfe6a
  5. added a commit that references this issue on Jan 20, 2021
    8a81967
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions