Generate an authorization URL to add a team manually. Useful, for example, for authorizing a team in a Shiny app.

auth_url(
  scopes = load_scopes(),
  redirect_uri = NULL,
  team_code = NULL,
  state = NULL
)

Arguments

scopes

character, scopes to request.

redirect_uri

character, the uri to which the user should be directed after authorization. If this is NULL (default), the user will be directed to the default redirection set up in the Slack app.

team_code

character, a team code to restrict the user to (in case they have multiple Slack teams authorized in their browser).

state

character, a code to send to your redirect_uri indicating a state. It is recommended to use a non-human-readable format for this string.

Value

character, an authorization URL.

Details

An environment variable controls this function:

  • SLACK_CLIENT_ID: character, the client_id of a Slack app. If this is not provided, the function will use the built-in R4DS Slack app.

Examples

auth_url()
#> [1] "https://slack.com/oauth/v2/authorize?user_scope=channels:read,users:read,groups:read,mpim:read,im:read,team:read&client_id=232409461636.994370873922"
auth_url(redirect_uri = "http://127.0.0.1:4242")
#> [1] "https://slack.com/oauth/v2/authorize?user_scope=channels:read,users:read,groups:read,mpim:read,im:read,team:read&client_id=232409461636.994370873922&redirect_uri=http://127.0.0.1:4242"
auth_url(redirect_uri = "http://127.0.0.1:4242", team_code = "T6UC1DKJQ")
#> [1] "https://slack.com/oauth/v2/authorize?user_scope=channels:read,users:read,groups:read,mpim:read,im:read,team:read&client_id=232409461636.994370873922&redirect_uri=http://127.0.0.1:4242&team=T6UC1DKJQ"
auth_url(state = "aabbCCddeeFF")
#> [1] "https://slack.com/oauth/v2/authorize?user_scope=channels:read,users:read,groups:read,mpim:read,im:read,team:read&client_id=232409461636.994370873922&state=aabbCCddeeFF"