craighooghiem / oauth-php

oAuth PHP
MIT License
0 stars 0 forks source link

No support for duplicate consumer keys #27

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
From freeklijten in the wiki:

In the addServerToken function of OAuthStoreMySQL.php the server id is
aquired trough the following query:

$ocr_id = $this->query_one('
        SELECT ocr_id
        FROM oauth_consumer_registry
        WHERE ocr_consumer_key = \'%s\'
                ', $consumer_key);

Googles OAuth implementation supports non-registered applications to be
allowed to interact with its API's by using "anonymous" as consumer key and
consumer secret. In this case multiple users can be associated with the
same consumer key resulting in the first server found in above query being
used while inserting token.

I don't know if this is a bug or me using the wrong constructs but I hope
someone can clarify this for me.

Original issue reported on code.google.com by brunobg%...@gtempaccount.com on 18 Feb 2010 at 5:20

GoogleCodeExporter commented 8 years ago
I had the same problem and believe this is a bug. I fixed it by modifying the 
above 
code to:

$ocr_id = $this->query_one('
                    SELECT ocr_id
                    FROM oauth_consumer_registry
                    WHERE ocr_consumer_key = \'%s\'
                    AND ocr_usa_id_ref = %d
                    ', $consumer_key, $user_id);

And it seems to be working as expected now.

Hope that helps!

Original comment by burakatn...@gmail.com on 28 Apr 2010 at 3:48

GoogleCodeExporter commented 8 years ago
Thanks a lot, burak. I think this should solve it, and I just added it to r120. 
I'll
leave this open for a while to see if anyone has problems with this fix, but I 
think
this one is closed.

Original comment by brunobg%...@gtempaccount.com on 28 Apr 2010 at 6:04

GoogleCodeExporter commented 8 years ago

Original comment by brunobg%...@gtempaccount.com on 28 Apr 2010 at 6:04

GoogleCodeExporter commented 8 years ago

Original comment by brunobg%...@gtempaccount.com on 17 Jun 2010 at 12:45