Skip to content

Is it possible to handle OAuth flow entirely with websockets? #583

@nimjor

Description

@nimjor

Our team has an app that currently uses Flask and the OAuth flow to allow our users to set up incoming webhooks in a self-service fashion. We are trying to rewrite the app to use Socket Mode. Using OAuth flow seems to require a redirect URL, but the redirect URL requires HTTP/S. We verified that the SocketModeHandler client's wss_uri is not accepted as the redirect URL. Is there a way to complete the OAuth flow without exposing some HTTP endpoint? It seems almost everything can be done except for passing the generated authorization code back to the socket mode app. If we had a way to get that code, it seems we would be able to use app.client.oauth_v2_access to finish the flow.

Reproducible in:

The slack_bolt version

slack-bolt==1.6.1
slack-sdk==3.6.0
slackclient==2.5.0

Python runtime version

Python 3.9.9

OS info

ProductName: macOS
ProductVersion: 11.6.2
BuildVersion: 20G314
Darwin Kernel Version 20.6.0: Wed Nov 10 22:23:07 PST 2021; root:xnu-7195.141.14~1/RELEASE_X86_64

Steps to reproduce:

There is nothing to reproduce as this is a question about whether the above is possible. In all our searching in the docs and others' questions we have not found an answer.

Expected result:

Bolt OAuth functionality works regardless of connection type.

Actual result:

There appears to be no way to have the websocket-based Slack app receive the generated OAuth authorization code upon user authorization.

Requirements

An answer to this question would be appreciated; a method/example for completing the OAuth flow with websocket connections would be even better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions