Sample - Slack Web API
GET/oauth.v2.access

Exchange an OAuth verifier code for access tokens

Exchanges a temporary OAuth verifier code for access tokens with scopes for a bot user and a user token. Supply the required code from the OAuth callback and the application credentials, and provide redirect_uri when it was part of the original authorization request. The response confirms whether the token exchange succeeded.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

4 parameters
client_idstringoptional
Application identifier issued when the application was created.
client_secretstringoptional
Application secret issued when the application was created.
codestringrequired
Required temporary verifier code returned through the OAuth callback.
redirect_uristringoptional
Redirect URI that must match the originally submitted URI when one was provided.

2 status codes
200Returns an object with `ok` set to true confirming successful token negotiation for bot-user and user-token scopes.
okbooleanrequired
Allowed:true
defaultReturned when the OAuth verifier, application credentials, or redirect URI is invalid; the response includes `ok` set to false.
okbooleanrequired
Allowed:false

Error handling

The code parameter is required and must be the verifier returned through the OAuth callback. If redirect_uri is supplied, it must exactly match the originally submitted URI, and client_id and client_secret must belong to the application.