Exchanges a temporary OAuth verifier code for an access token. https://docs.slack.dev/reference/methods/oauth.v2.access
(
self,
*,
client_id: str,
client_secret: str,
# This field is required when processing the OAuth redirect URL requests
# while it's absent for token rotation
code: Optional[str] = None,
redirect_uri: Optional[str] = None,
# This field is required for token rotation
grant_type: Optional[str] = None,
# This field is required for token rotation
refresh_token: Optional[str] = None,
**kwargs,
)
| 4541 | # -------------------------- |
| 4542 | |
| 4543 | def oauth_v2_access( |
| 4544 | self, |
| 4545 | *, |
| 4546 | client_id: str, |
| 4547 | client_secret: str, |
| 4548 | # This field is required when processing the OAuth redirect URL requests |
| 4549 | # while it's absent for token rotation |
| 4550 | code: Optional[str] = None, |
| 4551 | redirect_uri: Optional[str] = None, |
| 4552 | # This field is required for token rotation |
| 4553 | grant_type: Optional[str] = None, |
| 4554 | # This field is required for token rotation |
| 4555 | refresh_token: Optional[str] = None, |
| 4556 | **kwargs, |
| 4557 | ) -> SlackResponse: |
| 4558 | """Exchanges a temporary OAuth verifier code for an access token. |
| 4559 | https://docs.slack.dev/reference/methods/oauth.v2.access |
| 4560 | """ |
| 4561 | if redirect_uri is not None: |
| 4562 | kwargs.update({"redirect_uri": redirect_uri}) |
| 4563 | if code is not None: |
| 4564 | kwargs.update({"code": code}) |
| 4565 | if grant_type is not None: |
| 4566 | kwargs.update({"grant_type": grant_type}) |
| 4567 | if refresh_token is not None: |
| 4568 | kwargs.update({"refresh_token": refresh_token}) |
| 4569 | return self.api_call( |
| 4570 | "oauth.v2.access", |
| 4571 | data=kwargs, |
| 4572 | auth={"client_id": client_id, "client_secret": client_secret}, |
| 4573 | ) |
| 4574 | |
| 4575 | def oauth_access( |
| 4576 | self, |