Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pocesar/twitter-kohana
Kohana 3.3 module for Twitter OAuth library
https://github.com/pocesar/twitter-kohana
Last synced: 17 days ago
JSON representation
Kohana 3.3 module for Twitter OAuth library
- Host: GitHub
- URL: https://github.com/pocesar/twitter-kohana
- Owner: pocesar
- Created: 2013-04-27T02:49:06.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-05-05T21:24:14.000Z (over 11 years ago)
- Last Synced: 2024-10-18T06:28:20.946Z (27 days ago)
- Language: PHP
- Size: 120 KB
- Stars: 8
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Kohana 3.3 OAuth Helper for Twitter
============This module uses git://github.com/abraham/twitteroauth.git and provide an easier workflow for Twitter OAuth without many extra steps.
# Usage:
### Set your APPPATH/config/twitterauth.php with
```php
return array(
'consumer_key' => 'get it from dev.twitter.com',
'consumer_secret' => 'get it from dev.twitter.com'
);
```### In your controller, check if the user is already logged in:
```php
$twitter = Twitterauth::factory()->init();
if (!($user = $twitter->getUser()))
{
// Not logged in or not authorize, send them to the authorize APP url
HTTP::redirect($twitter->getAuthorizeURL()));
}
else
{
// $user->screen_name
}
```Done. The redirect should happen in a popup, since the callback calls `window.close()`. The module takes care of the cookies and session variables for you.
If you want, overwrite the original `Controller_Twitterauth_Index` controller so you can control the denied / errors by yourself (currently it simply ignores it) or even override the callback Route using `Route::set('twitter-auth', 'your-route')`