401 error while trying to call Twitter stream API

久未见 提交于 2019-12-05 16:56:13

You haven't included the HTTP method or the base URL into your baseString before you compute the signature. This is taken from the Twitter site:

Creating the signature base string

The three values collected so far must be joined to make a single string, from which the signature will be generated. This is called the signature base string by the OAuth specification.

To encode the HTTP method, base URL, and parameter string into a single string:

  1. Convert the HTTP Method to uppercase and set the output string equal to this value.

  2. Append the '&' character to the output string.

  3. Percent encode the URL and append it to the output string.

  4. Append the '&' character to the output string.

  5. Percent encode the parameter string and append it to the output string.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!