peresleguine
peresleguine

Reputation: 2403

Determine which slack user has granted the access token

According to the docs, after a permission is granted, I receive this kind of JSON response:

{
    "access_token": "xoxp-XXXXXXXX-XXXXXXXX-XXXXX",
    "scope": "incoming-webhook,commands,bot",
    "team_name": "Team Installing Your Hook",
    "team_id": "XXXXXXXXXX",
    "incoming_webhook": {
        "url": "https://hooks.slack.com/TXXXXX/BXXXXX/XXXXXXXXXX",
        "channel": "#channel-it-will-post-to",
        "configuration_url": "https://teamname.slack.com/services/BXXXXX"
    },
    "bot":{
        "bot_user_id":"UTTTTTTTTTTR",
        "bot_access_token":"xoxb-XXXXXXXXXXXX-TTTTTTTTTTTTTT"
    }
}

Is there a way to determine which slack user has granted the access?

Upvotes: 2

Views: 154

Answers (1)

peresleguine
peresleguine

Reputation: 2403

In case if anyone interested, slack team recently added user_id to the output. Moreover you can call web api method auth.test which will give you the user_id if access token has been provided.

Upvotes: 1

Related Questions