Skip to content

AsyncOAuthSettings uses CallbackOptions instead of AsyncCallbackOptions #210

@jwelch92

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.

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