向 stocktwits 验证用户
authenticating user to stocktwits
正在为单个用户搜索获取 access_token 的方法。看起来 API Documentation 表示可以通过单个 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 看起来正在重定向到登录页面。此功能是否已删除或我在某处犯了错误?
看起来是对文档的误解。您无法通过自己的请求获取访问令牌。文档状态
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
正在为单个用户搜索获取 access_token 的方法。看起来 API Documentation 表示可以通过单个 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 看起来正在重定向到登录页面。此功能是否已删除或我在某处犯了错误?
看起来是对文档的误解。您无法通过自己的请求获取访问令牌。文档状态
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