0

搜索获取单个用户的 access_token 的方法。看起来API 文档说它可以通过单个 curl 请求对用户进行身份验证并获取 access_token :

cURL [ about cURL ]
// Token example
curl -X GET -u <username> -p https://api.stocktwits.com/api/2/oauth/authorize -d 'client_id=<client id>&response_type=token&redirect_uri=http://www.example.com&scope=read,watch_lists,publish_messages,publish_watch_lists,follow_users,follow_stocks'

// Code example
curl -X GET https://api.stocktwits.com/api/2/oauth/authorize -d 'client_id=<client id>&response_type=code&redirect_uri=http://www.example.com&scope=read,watch_lists,publish_messages,publish_watch_lists,follow_users,follow_stocks'

但是尝试了几次使用令牌示例提供用户名和密码的尝试,但 stocktwits 看起来正在重定向到登录页面。此功能是否已删除或我在某处犯了错误?

4

1 回答 1

0

看起来是对文档的误解。您自己无法通过请求获取访问令牌。文档状态

Your application requests authorization by redirecting your user to https://api.stocktwits.com/api/2/oauth/authorize with your client_id, response_type set to 'code' and the URL the user should be redirected back to after the authorization process (redirect_uri). Scopes can also be passed (scope) in a comma-delimited list to request further permissions. View the authorize call. Enter the following URL into your browser or direct your users to it for authentication:

您的用户将他们定向到 url 后,在提供的表单上输入他们的凭据。请参阅https://stocktwits.com/developers/docs/authentication

于 2017-02-01T21:26:15.560 回答