验证用户库存

时间:2017-02-01 11:38:02

标签: curl stocktwits

搜索为单个用户获取access_token的方法。看起来API Documentation表示可以通过单个卷曲请求对用户进行身份验证并获取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看起来正在重定向到Login页面。是删除了这个功能还是在某处犯了错误?

1 个答案:

答案 0 :(得分: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:

您的用户在将其指向网址后,会在提供的表单上输入其凭据。请参阅https://stocktwits.com/developers/docs/authentication