-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
🎉 Source Slack: Implement OAuth support with OAuth authenticator #6570
Conversation
/test connector=connectors/source-slack
|
docs/integrations/sources/slack.md
Outdated
@@ -101,6 +108,7 @@ We recommend creating a restricted, read-only key specifically for Airbyte acces | |||
|
|||
| Version | Date | Pull Request | Subject | | |||
| :------ | :-------- | :----- | :------ | | |||
| 0.1.12 | 2021-08-?? | [????](https://github.com/airbytehq/airbyte/pull/????) | Implement OAuth support with OAuth authenticator | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't forget to replace it
/test connector=connectors/source-slack
|
/test connector=connectors/source-slack
|
airbyte-integrations/connectors/source-slack/source_slack/source.py
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/source-slack/source_slack/spec.json
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/source-slack/source_slack/spec.json
Outdated
Show resolved
Hide resolved
if credentials_title == "Default OAuth2.0 authorization": | ||
# We can get `refresh_token` only if the token rotation function is enabled for the Slack Application. | ||
# If it is disabled, then we use the generated `access_token`, which acts without expiration. | ||
if credentials.get("refresh_token", "").strip(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use the option name, as that is the only thing guaranteed to be uniquely present
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a fork here that needs to be handled. If Token rotation is enabled for the application, then in the response to the oauth.v2.access
request we will receive both Access token(which expires after some time) and Refresh token(with which we can create a new Access token).
However, if the Token rotation
function is disabled for the application, then in this case we will receive only Access token in the response to oauth.v2.access
and it will be unlimited.
For this reason, we cannot indicate in the specification that Refresh Token is a required field (since it simply may not exist) and we cannot remove Access Token from required (since it may be unlimited and we will need to use it).
"type": "object", | ||
"title": "OAuth2.0 authorization", | ||
"required": [ | ||
"access_token", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refresh token is the required one since it can be used to generate access tokens
"access_token", | |
"refresh_token", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment above
"examples": ["slack-client-secret-example"], | ||
"airbyte_secret": true | ||
}, | ||
"access_token": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i suggest we remove the access token since it expires anyways, and just rely on refresh token
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment above
airbyte-integrations/connectors/source-slack/source_slack/spec.json
Outdated
Show resolved
Hide resolved
@@ -285,16 +284,36 @@ def request_body_json(self, stream_slice: Mapping = None, **kwargs) -> Optional[ | |||
|
|||
|
|||
class SourceSlack(AbstractSource): | |||
def _get_authenticator(self, config: Mapping[str, Any]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be backwards compatible with the previous config format to prevent a breaking change for current users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/test connector=connectors/source-slack
|
credentials = config.get("credentials") | ||
credentials_title = credentials.get("option_title") | ||
if credentials_title == "Default OAuth2.0 authorization": | ||
# We can get `refresh_token` only if the token rotation function is enabled for the Slack Application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# We can get `refresh_token` only if the token rotation function is enabled for the Slack Application. | |
# We can get `refresh_token` only if the token rotation function is enabled for the Slack Oauth Application. |
/publish connector=connectors/source-slack
|
…urochkin/slack-oauth-support
/publish connector=connectors/source-slack
|
…bytehq#6570) * Source Slack: Implement OAuth support with OAuth authenticator
What
closes #6256 .
How
Describe the solution
Recommended reading order
x.java
y.python
Pre-merge Checklist
Expand the relevant checklist and delete the others.
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing./publish
command described here