In an API url, what does "Scope" mean?

Asked

Viewed 117 times

3

I’m working on a Slack API using Vb.net to program. On the page of the site there is how to assemble the request url of the API methods, but in one of the parameters is highlighted: "Requires Scope: Channels:read". This is my current code:

     Dim oRequest As System.Net.HttpWebRequest

        oRequest = System.Net.WebRequest.CreateHttp("https://slack.com/api/channels.list?token=" & oAccessToken.access_token & "&exclude_archived=1")
        oRequest.Method = "POST"
        oRequest.UserAgent = "Aplicação"
        Dim httpResponse As HttpWebResponse = oRequest.GetResponse()
        Using streamReader = New StreamReader(httpResponse.GetResponseStream())
            Dim result = streamReader.ReadToEnd()
            Console.WriteLine(result)
        End Using

In this way returns the following JSON:

{
    "ok": false,
    "error": "missing_scope",
    "needed": "channels:read",
    "provided": "identify,bot"
}

This is one of the pages containing information about the API: https://api.slack.com/methods/channels.list Using Webrequest how can I fit this "Channels:read" that appears to be missing?

1 answer

0

This API requires Oauth appliance.

In Oauth a Scope is an aggregate of resources. To get access to these features the user has to confirm that he can get access to the corresponding Scope.

For example: In android applications most applications ask you for permission to access the internet.

The concept is exactly the same in Oauth. In the case of Slack you can see the Copes here

I would then have to make a request to

https://slack.com/oauth/authorize?client_id=...&scope=channels:read

See the oauth section of Slack

Browser other questions tagged

You are not signed in. Login or sign up in order to post.