Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Slack user name through oAuth API

I'm using th eSlack oAuth API to integrate my app with Slack. Following these instructions I do the following:

  1. Call https://slack.com/oauth/authorize passing my client_id, and the scope "identify,read,post -> I get a code
  2. Call https://slack.com/api/oauth.access with the id, secret, code -> I get an access token
  3. I now want to get the user's handle (name) -> looking at the user.info documentation, I need to provide my token, and the user's ID - which I don't have.

Where/how am I supposed to get the user's ID? What am I missing?

like image 700
Traveling Tech Guy Avatar asked Sep 01 '15 00:09

Traveling Tech Guy


People also ask

How do I get my Slack user token?

Visit the App Directory at my.slack.com/apps/manage on your desktop. Click Edit configuration next to the integration. On the configuration page, click Regenerate below the current token. This is the new token you can use anywhere you need it.

How do I find my Slack client ID?

Create application and get Client ID, Client Secret Key 1) Go to the https://api.slack.com/apps URL to create the app. 2) Click Your Apps > Create New App. 3) Enter App Name and select workspace. 4) Copy Client ID and Client Secret from above details, you will need them in later steps while creating Slack Connector.

Is there an API for Slack?

The Slack Web API is an interface for querying information from and enacting change in a Slack workspace. Use it on the fly for ad-hoc queries, or as part of a more complex tapestry of platform features in a Slack app.


1 Answers

You have access to this information in the auth.test endpoint. It will also return the team id, user id, and user's name.

like image 65
osowskit Avatar answered Oct 13 '22 10:10

osowskit