我一直在尝试实施“使用Twitter登录”,但我一直试图找出如何为用户获取OAuth令牌的秘密。
Twitter API文档(here)说:
要启动登录流程,您的应用程序必须通过向POST oauth / request_token
发送签名消息来获取请求令牌...
响应正文将包含oauth_token, oauth_token_secret 和oauth_callback_confirmed参数
创建签名的文档(here)说:
标识您的应用程序代表的帐户的值称为 oauth令牌密钥。该值可以通过多种方式获得,所有这些都在获取访问令牌中进行了描述。
“获取访问权限”页面会链接回here,完成圈子。
如果我需要一个令牌密钥来签署获取令牌密钥的请求,我如何获得令牌密钥?到底是什么?
答案 0 :(得分:1)
从创建签名的文档:
Note that there are some flows, such as when obtaining a request token,
where the token secret is not yet known. In this case, the signing key
should consist of the percent encoded consumer secret followed by an
ampersand character '&'.
您在注册API密钥时收到消费者密钥。这是您要签署以获取请求令牌的内容。
我强烈建议使用至少实现oauth基础知识的库,例如签名,如果不是Twitter API library,假设有一个可用于您选择的语言。