Skip to content

Commit 2a2cc81

Browse files
zimegClaude
andcommitted
feat(methods): add oauth.v2.user.access method example
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
1 parent 2bf1c9c commit 2a2cc81

7 files changed

Lines changed: 44 additions & 0 deletions

File tree

‎methods/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ $ slack run chat_post_message.py # Make the request
7272

7373
- **[oauth.v2.beginShortTokenRotation](https://docs.slack.dev/reference/methods/oauth.v2.beginShortTokenRotation)**: Begins rotating the secret on an API token with a short secret. [Implementation](./src/oauth/v2/oauth_v2_begin_short_token_rotation.py).
7474
- **[oauth.v2.completeShortTokenRotation](https://docs.slack.dev/reference/methods/oauth.v2.completeShortTokenRotation)**: Finishes rotating the secret on an API token with a short secret. [Implementation](./src/oauth/v2/oauth_v2_complete_short_token_rotation.py).
75+
- **[oauth.v2.user.access](https://docs.slack.dev/reference/methods/oauth.v2.user.access)**: Exchanges a temporary OAuth verifier code for a user access token. [Implementation](./src/oauth/v2/user/oauth_v2_user_access.py).
7576

7677
### slackbot
7778

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
apps.dev.json
2+
cache/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"manifest": {
3+
"source": "local"
4+
},
5+
"project_id": "00000000-0000-0000-0000-000000000000"
6+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"hooks": {
3+
"get-hooks": "python3 -m slack_cli_hooks.hooks.get_hooks"
4+
}
5+
}

‎methods/src/oauth/v2/user/__init__.py‎

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"display_information": {
3+
"name": "Slack API Methods",
4+
"description": "Example implementations to call \"oauth.v2.user\" methods"
5+
},
6+
"oauth_config": {
7+
"scopes": {
8+
"bot": []
9+
}
10+
},
11+
"settings": {
12+
"org_deploy_enabled": true,
13+
"socket_mode_enabled": false,
14+
"token_rotation_enabled": false
15+
}
16+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from slack_sdk import WebClient
2+
3+
# Initialize
4+
client = WebClient()
5+
6+
# Call the oauth.v2.user.access method
7+
response = client.oauth_v2_user_access(
8+
client_id="2141029472.691202649728",
9+
client_secret="e1b9e11dfcd19c1982d5de12921e17e8c",
10+
code="4724469134.4644010092847.232b4e6d82c333b475fc30f5f5a341d294feb1a94392c2fd791f7ab7731a443d1a",
11+
)
12+
13+
# Inspect the response
14+
print(response)

0 commit comments

Comments
 (0)