2
votes

Using slack oauth api i setup an app for user to login, the app is accessable to both admin & user, the problem is that even calling auth.access, i am able to get token details, but there i cannot find any way to find if the logined user is admin or not, response is same for both admin & normal user. response from auth.access

{
   "ok": true, 
   "user_id": "UNxxxxxxx', 
   "access_token": "xoxp-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxxxx-......xx", 
   "bot": {
       "bot_access_token": "xoxb-xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx", 
       "bot_user_id": "Uxxxxxxxx"
   }, 
   "team_id": "Txxxxxxxxx", 
   "scope": "identify,bot,channels:read,users:read...", 
   "team_name": "Team Name"
}
2

2 Answers

4
votes

You could compare the user's ID with their entry in the users.list API method. Each user has elements for is_owner and is_admin.

Here's a shortened version of the example response from the page:

{
    "ok": true,
    "members": [
        {
            "id": "U023BECGF",
            "team_id": "T021F9ZE2",
            "name": "bobby",
            ...
            "is_admin": true,
            "is_owner": true,
        },
        ...
    ]
}
1
votes

Dont know answering my own question is good or not, when i checked slack oauth documentation suggested by Heiko Koelle, found the answer users.info will respond back "is_admin" and "is_owner" boolean values, was in hurry :)