claromentis/opauth-twitter

Opauth的Twitter策略

1.0.0 2015-12-29 09:56 UTC

This package is auto-updated.

Last update: 2024-08-28 01:53:19 UTC


README

基于Opauth-OAuth的Twitter策略Opauth

入门指南

  1. 安装Opauth-Twitter

    cd path/to/app/root
    composer require opauth/twitter:dev-wip/1.0
  2. https://dev.twitter.com/apps创建Twitter应用

    • 务必输入回调URL,否则回调将被禁止。回调URL可以是任意一个,因为Opauth会在OAuth过程中明确提供正确的回调URL。
    • 在@Anywhere域名中注册您的域名。Twitter只允许从授权域名进行认证。
  3. 使用至少消费者密钥消费者密钥配置Opauth-Twitter策略。

  4. 将用户直接导向http://path_to_opauth/twitter进行认证

策略配置

所需参数

<?php
'Twitter' => array(
	'key' => 'YOUR CONSUMER KEY',
	'secret' => 'YOUR CONSUMER SECRET'
)

有关可选参数,请参阅Twitter.php。

Opauth-Twitter默认使用Sign In with Twitter。如果您想使用3-legged OAuth,请明确添加到策略配置中的authenticate_url参数,并将其设置为https://api.twitter.com/oauth/authorize

依赖关系

tmhOAuth需要hash_hmac和cURL。hash_hmac在PHP 5 >= 5.1.2中可用。

参考

许可证

Opauth-Twitter是MIT许可证,版权所有 © 2012 U-Zyn Chua (http://uzyn.com)

tmhOAuth是Apache 2许可证。