= OAuth for Geeklog - Login via Twitter Facebook LinkedIn OAuth =

  Geeklog Version: Geeklog 1.7.0
  Service: Twitter, Facebook, LinkedIn

  Author: Hiroshi Sakuramoto 
  Presented by
    IVY WE CO.,LTD. / Tetsuko Komma (Ivy) / komma AT ivywe DOT co DOT jp
    WinKey / Hiroshi Sakuramoto (hiroron) / hiro AT winkey DOT jp

                                                        Modified Date 2010/08/22
                                                                   Version 1.0.0


This is an OAuth hack for Geeklog using APIs provided by Twitter, Facebook and LinkedIn.

Geeklog's user account is created by login with OAuth. 

Login with OAuth API is more smart than login with 3rdParty that need password in the site.

OpenID login and OAuth API login is similar, but OAuth API login don't need provider URL.

Facebook OAuth API provide email, too.
But Twitter and LinkedIn OAuth API does not provide email.

When user login with Twitter OAuth API, Geeklog send welcome message by Twitter Direct message.
Direct message is formatted by language file.



== Install ==

  * <geeklog_dir> ...Geeklog dir include db-config.php
  * <public_html> ...Public directory include lib-common.php
  * <admin> ...<public_html>/admin


=== Change to Geeklog ===

Please backup these file before change.

  <geeklog_dir>/language/english.php
  <geeklog_dir>/language/japanese_utf-8.php
  <geeklog_dir>/system/lib-security.php
  <public_html>/lib-common.php
  <public_html>/users.php
  <public_html>/layout/<theme>/loginform.thtml
  <public_html>/layout/<theme>/users/loginform.thtml


=== Install ===

  1. language                               -> <geeklog_dir>/language/
  2. system/pear                            -> <geeklog_dir>/system/pear/
  3. system/classes                         -> <geeklog_dir>/system/classes/
  4. system/lib-security.php                -> <geeklog_dir>/system/
  5. public_html/images                     -> <public_html>/images/
  5. public_html/layout                     -> <public_html>/layout/
  6. public_html/lib-common.php, users.php  -> <public_html>/



== Setting ==

=== Create an Application on API ===

==== Twitter ====

Access 'Applications Using Twitter' page and click 'Register a new application »'.
https://twitter.com/apps

Application Type: Select 'Browser'
Callback URL: Input URL same as Website
Default Access type: Select 'Read & Write'
Use Twitter for login: Check!

Set 'Consumer key' and 'Consumer secret' at bellow file.
<geeklog_dir>/system/classes/oauth/twitter.auth.class.php line:41,42

    public $consumer_key = 'xxxxxxxxxxxxxxxxxxxxx';                   // <-- Consumer key
    public $consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';  // <-- Consumer secret



==== Facebook ====

Access Facebook 'Create an Application' page, and input form.
http://developers.facebook.com/setup/

Set 'Application ID' and 'Application Secret' at bellow file.
<geeklog_dir>/system/classes/oauth/facebook.auth.class.php line:38,39

    public $consumer_key = 'xxxxxxxxxxxxxxx';                         // <--  Application ID
    public $consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';     // <--  Application Secret



==== LinkedIn ====

Access Facebook 'List of Applications' page, and click 'Add New Application'.
https://www.linkedin.com/secure/developer

<geeklog_dir>/system/classes/oauth/linkedin.auth.class.php line:41,42

    public $consumer_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';  // <-- API Key
    public $consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';  // <-- Secret Key



=== Configuration ===

    $_CONF is added to lib-common.php.

       lib-common.php line 7224:

       // OAuth Config Add -- hiroron
       $_CONF['user_login_method']['oauth'] = true;

    Set 'true' or 'false'



=== Templates ===

Default: <public_html>/layout/<your_theme>/login_oauth.thtml

Custom: <public_html>/layout/<your_theme>/login_<servicename>.thtml
Priority is higher than default templates.




=== How to delete unnecessary OAuth ===

Delete unnecessary <geeklog_dir>/system/classes/oauth/xxxxx.auth.class.php.



== Account description and notice ==


   OAuth          |    Password      |    email
------------------+------------------+----------------------
 Twitter          | no               | no
------------------+------------------+----------------------
 Facebook         | no               | yes
------------------+------------------+----------------------
 LinkedIn         | no               | no
------------------+------------------+----------------------

Reference
 OpenID           | no               | Depend on OpenID
------------------+------------------+----------------------



== OAuth hack files ==

Geeklog 1.7.0 OAuth hack source.

(+) new
system
  language/english.php
  language/japanese_utf-8.php
  system/lib-security.php
  system/classes/oauthhelper.class.php (+)
  system/classes/oauth/twitter.auth.class.php (+)
  system/classes/oauth/facebook.auth.class.php (+)
  system/classes/oauth/linkedin.auth.class.php (+)

PEAR
  system/pear/Net/URL2.php (+)      <- Net_URL2-0.3.1
  system/pear/HTTP/Request2.php (+) <- HTTP_Request2-0.5.2
  system/pear/HTTP/Request2/* (+)   <- HTTP_Request2-0.5.2
  system/pear/HTTP/OAuth.php (+)    <- HTTP_OAuth-0.1.18
  system/pear/HTTP/OAuth/* (+)      <- HTTP_OAuth-0.1.18
  

<publick_html>
  public_html/lib-common.php
  public_html/users.php
  public_html/images/sign-in-with-twitter.png (+)
  public_html/images/sign-in-with-twitter-sm.png (+)
  public_html/images/sign-in-with-facebook.png (+)
  public_html/images/sign-in-with-linkedin.png (+)

Theme
  public_html/layout/<theme>/loginform.thtml
  public_html/layout/<theme>/loginform_oauth.thtml (+)
  public_html/layout/<theme>/users/loginform.thtml


