CodeIgniter Forums
A3M - Account Authentication & Authorization Module - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: A3M - Account Authentication & Authorization Module (/showthread.php?tid=27290)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39


A3M - Account Authentication & Authorization Module - El Forum - 04-06-2010

[eluser]vicman[/eluser]
Great work.


A3M - Account Authentication & Authorization Module - El Forum - 04-06-2010

[eluser]Peng Kong[/eluser]
thanks vicman. let me know ur experience using it or integrating it please. it would be most helpful Smile


A3M - Account Authentication & Authorization Module - El Forum - 04-06-2010

[eluser]loosetops[/eluser]
Bug Report

I have found the cause to the error I was getting while trying to view the link http://domain.com/a3m/oauth/apps
Quote:Fatal error: Uncaught exception ‘OAuthException2’ with message ‘No OAuthStore for mysql (file /homepages/37/d248106511/htdocs/domain/a3m/application/modules/oauth/libraries/oauth-php/library/store/OAuthStoremysql.php)’ in /homepages/37/d248106511/htdocs/domain/a3m/application/modules/oauth/libraries/oauth-php/library/OAuthStore.php:76
Stack trace:
#0 /homepages/37/d248106511/htdocs/domain/a3m/application/modules/oauth/controllers/oauth.php(25): OAuthStore::instance(‘mysql’, Array)
#1 /homepages/37/d248106511/htdocs/domain/a3m/system/codeigniter/CodeIgniter.php(201): OAuth->OAuth()
#2 /homepages/37/d248106511/htdocs/domain/a3m/index.php(115): require_once(’/homepages/37/d…’)
#3 {main}
thrown in /homepages/37/d248106511/htdocs/domain/a3m/application/modules/oauth/libraries/oauth-php/library/OAuthStore.php on line 76

The bug is at this section
file: [modules/oauth/controllers/oauth.php]
Code:
function OAuth()
    {
        parent::Controller();
        
        require_once APPPATH.'/modules/oauth/libraries/oauth-php/library/OAuthServer.php';
        require_once APPPATH.'/modules/oauth/libraries/oauth-php/library/OAuthStore.php';
        $DB = $this->load->database('default', TRUE);
        $this->store = OAuthStore::instance($DB->dbdriver, array('conn' => $DB->conn_id));
        $this->server = new OAuthServer();
    }

The property $DB->dbdriver returns mysql instead of MySQL.

This leads to the creation of a file that doesn't exist in modules/oauth/libraries/oauth-php/library/OAuthStore.php
Code:
public static function instance ( $store = 'MySQL', $options = array() )
    {  
        if (!OAuthStore::$instance)
        {
            // Select the store you want to use
            if (strpos($store, '/') === false)
            {
                $class = 'OAuthStore'.$store;
                $file  = dirname(__FILE__) . '/store/'.$class.'.php';
            }

So
$file is modules/oauth/libraries/oauth-php/library/store/OAuthStoremysql.php instead of
modules/oauth/libraries/oauth-php/library/store/OAuthStoreMySQL.php

For now, I'm overriding the passed variable of 'mysql' with 'MySQL' and this is what the page looks like.

Looking at all driver specific files in modules/oauth/libraries/oauth-php/library/store/ a general fix that takes care of this lowercase issue is maybe needed.

Very good job once again. This is one monster that is going down.


A3M - Account Authentication & Authorization Module - El Forum - 04-06-2010

[eluser]Peng Kong[/eluser]
that's exactly what the page should look like Big Grin

crap, ok no error on windows becuz upper/lower cases doesn't affect but on *nix it does.
i was trying not to hardcode "MySQL" incase some of us were using the other databases supported by CI.
i think the best way now is to write a "converter" to link between the full lowercase given by $DB->dbdriver (based on all the possible CI dbs) and the way casing is done in oauth-php.
will patch this into next version.

thanks for helping to smash this bug Wink


A3M - Account Authentication & Authorization Module - El Forum - 04-07-2010

[eluser]ShannenName[/eluser]
When you can please check out the bugs I have pointed out on the google codes page.
http://code.google.com/p/a3m/issues/list


A3M - Account Authentication & Authorization Module - El Forum - 04-07-2010

[eluser]Peng Kong[/eluser]
ok great you're first to use it Big Grin


A3M - Account Authentication & Authorization Module - El Forum - 04-07-2010

[eluser]Isern Palaus[/eluser]
Love this, I will implement to a new fashion portal I've to design/code.

I repeat: LOVE IT Smile!


A3M - Account Authentication & Authorization Module - El Forum - 04-07-2010

[eluser]Peng Kong[/eluser]
cool! share with us the url when you're done k Smile thanks


A3M - Account Authentication & Authorization Module - El Forum - 04-07-2010

[eluser]ShannenName[/eluser]
What I'm planning to do is create a portal where users join then link all their accounts so they can post/view/do whatever the api let's them from one website.


A3M - Account Authentication & Authorization Module - El Forum - 04-08-2010

[eluser]Peng Kong[/eluser]
1) i stand corrected, google and yahoo! works without SSL.
therefore i've disabled SSL by default in the config

2) removed all php short tags so rewrite isn't need.

3) fix oauth-php db lower case issue. now mysql and mysqli will work.

4) fix query strings issue with '/' is needed before GET ? if request_uri is used.
all ? for GET in URL will be preceeded with '/'

these fixes will be in v0.7 (currently it's v0.6) along with ACL (which im starting next week).