Skip to content

feat(web-api): add oauth.v2.user.access method - #2872

Draft
zimeg wants to merge 1 commit into
mainfrom
zimeg-feat-oauth-v2-user-access
Draft

zimeg wants to merge 1 commit into
mainfrom
zimeg-feat-oauth-v2-user-access

Conversation

@zimeg

@zimeg zimeg commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

This pull request adds the oauth.v2.user.access method to @slack/web-api.

  • client.oauth.v2.user.access({ client_id, client_secret, code }) exchanges an OAuth code for a user token, for apps that request only user scopes, such as MCP clients.
  • The arguments mirror oauth.v2.access and add code_verifier for PKCE and assertion for the JWT authorization grant. grant_type also takes urn:ietf:params:oauth:grant-type:jwt-bearer, which assertion needs: without it the API reads the request as a code exchange.
  • It takes no scopes.
  • OauthV2UserAccessResponse is generated with the scripts/code_generator.rb quicktype options from the response on the docs page.
  • Adds type tests and a minor changeset.

This is the only pull request in the oauth stack (batch B6 oauth tokens), and it's based on main.

  1. feat(web-api): add oauth.v2.user.access method #2872 oauth.v2.user.access 👈 this pull request

Testing

  1. Send a user through https://slack.com/oauth/v2_user/authorize with only user scopes, then call client.oauth.v2.user.access({ client_id, client_secret, code }) and confirm access_token, token_type: 'user' and authed_user.

A real code needs a user to authorize in a browser, so the check used a test app's credentials with the docs example values. A code returned the documented invalid_code, a refresh_token grant returned invalid_refresh_token, and an assertion with the JWT bearer grant returned invalid_jwt_format. Each layer of this stack was checked against a developer sandbox by running every method added so far, in order, with that layer's WebClient.

Requirements

🤖 Generated with Claude Code

@zimeg zimeg added this to the web-api@next milestone Nov 18, 2026
@zimeg zimeg added semver:minor enhancement M-T: A feature request for new functionality area:typescript issues that specifically impact using the package from typescript projects pkg:web-api applies to `@slack/web-api` labels Nov 18, 2026
@zimeg zimeg self-assigned this Nov 18, 2026
@changeset-bot

changeset-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b7196d5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@slack/web-api Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.50%. Comparing base (653fc5c) to head (b7196d5).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2872      +/-   ##
==========================================
+ Coverage   94.34%   94.50%   +0.16%     
==========================================
  Files          68       68              
  Lines       10897    10906       +9     
  Branches      697      697              
==========================================
+ Hits        10281    10307      +26     
+ Misses        585      569      -16     
+ Partials       31       30       -1     
Flag Coverage Δ
cli-hooks 94.37% <100.00%> (+0.08%) ⬆️
cli-test 94.37% <100.00%> (+0.08%) ⬆️
logger 94.37% <100.00%> (+0.08%) ⬆️
oauth 94.37% <100.00%> (+0.08%) ⬆️
socket-mode 94.37% <100.00%> (+0.08%) ⬆️
web-api 94.37% <100.00%> (+0.08%) ⬆️
webhook 94.37% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg
zimeg changed the base branch from zimeg-feat-oauth-v2-complete-short-token-rotation to main November 18, 2026 06:50
@zimeg
zimeg force-pushed the zimeg-feat-oauth-v2-user-access branch from c0b8378 to b7196d5 Compare November 18, 2026 06:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:typescript issues that specifically impact using the package from typescript projects enhancement M-T: A feature request for new functionality pkg:web-api applies to `@slack/web-api` semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant