vb.net – In an API url, what does "scope" mean?

Question:

I'm working on a Slack API using vb.net to program. On the website page there is how to mount the request url of the API methods, however in one of the parameters it 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

This way returns the following JSON:

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

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

Answer:

This API requires OAuth authentication.

In OAuth a scope is an aggregate of features. To gain access to these resources, the user has to confirm that they are granted 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 scopes here

I would then have to place an order for

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

See Slack's oauth section

Scroll to Top