donjakobo/A3M

Google sign in error

Closed this issue · 21 comments

Google has deprecated OpenID 2.0 and will shut it down after a migration period.
So google accounts that have google+ enabled can't log in/sign up.

A3M v2 should fix this as it is using HybridAuth. If anyone wants to fix this for 1.x they are more than welcomed to submit a pull request.

In v2 it will be fixed via this: hybridauth/hybridauth#221

@donjakobo Your thoughts.

@donjakobo @AdwinTrave Hi, looks like v2 still didn't have the fix for Google OpenId 2.0 expiration, though there's a patch on hybridauth/hybridauth#221
Are there plans to fix it in v2?
Thank You

Actually if you look on HybridAuth the issue still wasn't resolved. I'm looking into this right now on v2, but my time is very limited so I don't know how far I'll get.

Thanks @AdwinTrave
I really would like to help with this because lots of my site users are authenticated via google, so in april, they won't be able to login, what's pretty critical for me :)
How can I help to complete this fix?
Maybe we should look into https://github.com/google/google-api-php-client as well?

Thanks

Hi @samuelsh
If you want to help the best way for version 2 would be to look on HybridAuth and fix the problem there. For v1 feel free to go into the code and make any changes you think are necessary. I will be happy to merge any PR that fixes this issue anywhere where I have the right to do so. I think the Google library you mentioned is something that could be applied to A3M v1.

Thanks

Thanks @AdwinTrave .
I started to look into A3M v2 at https://github.com/donjakobo/A3M (hopefully it's a right repo :))
The strange thing that I didn't find any mention of HybridAuth library. Actually looks like all the authentication stuff done vs. Yadis openID.

grep -nr --color "openid2" .
./application/helpers/account/php-openid-php5.3/Auth/OpenID/Discover.php:262:                                       
'openid2.provider', 'openid2.local_id')

Can you please elaborate on this? Can be that I'm looking into the wrong A3M version?
Thanx

You have the right repository, but the wrong branch.
Look here for v2: https://github.com/donjakobo/A3M/tree/ci3-beta

Thanks @AdwinTrave ,
Looking into that now.
One question, after enabling Google in account.php, I see "Google" icon on "Sign-in" page, but it takes me to non-existing page http://localhost/dogen/CodeIgniter/account/connect/Google.
How can I fix it?

Thanks

The link seems fine and it should be processed by controllers/account/Connect.php, what exactly is the error you get?

@AdwinTrave It's 404 "Page not found"

After littele debugging appeared that we failed to get 'third_party_auth' from config:
35: //get config for Hybrid Auth
36: $this->setup = $this->CI->config->item('third_party_auth');
37: log_message('debug', 'setup object: '.print_r($this->setup, true));

....
Output:
DEBUG - 2015-03-23 04:04:16 --> setup object:

Filename: account/Hybrid_auth_lib.php

Thanks

Ok this one fixed by modifying config.php:

$autoload['packages'] = array(APPPATH.'third_party/Hybrid');
...
$autoload['config'] = array("account/account.php");

But then failed on following:
Type: Hybrid_Exception

Message: Oophs. Error!

Filename: /home/dogen/htdocs/CodeIgniter/application/third_party/Hybrid/Endpoint.php

Line Number: 215

I guess it somehow fails to init:
Storage.php
210: Hybrid_Auth::initialize( $storage->config( "CONFIG" ) );

@AdwinTrave
Well looks like this is the problem:
Endpoint.php
// Check if Hybrid_Auth session already exist
if ( ! $storage->config( "CONFIG" ) ) {

                throw new Hybrid_Exception( "You cannot access this page directly." );
            }

Type: Hybrid_Exception

Message: Oophs. Error! You cannot access this page directly.

Filename: /home/dogen/htdocs/CodeIgniter/application/third_party/Hybrid/Endpoint.php

Line Number: 216

Do you have a solution for that issue?

Thanks

There were recently some changes made to the endpoint, I'll pull in the changes and we'll see if that makes any difference.

Thanks @AdwinTrave ,
Please let me know when you pull in the changes

Hi @AdwinTrave
I ugraded to newest, but there's still the same error:
Endpoint.php
// Check if Hybrid_Auth session already exist
if ( ! $storage->config( "CONFIG" ) ) {
throw new Hybrid_Exception( "You cannot access this page directly." );
}
...
Now when looking into Storage.php::config(), it looks like we'll always get exceptions, if "config" exists:
public function config($key, $value = null)
{
$key = strtolower( $key );

    if( $value ){
        $_SESSION["HA::CONFIG"][$key] = serialize( $value );
    }
    elseif( isset( $_SESSION["HA::CONFIG"][$key] ) ){
        return unserialize( $_SESSION["HA::CONFIG"][$key] );
    }

return NULL;
}

I can't understand the logic behind, maybe it supposed to pevents initialise Hybrid session twice?
And if so, how can it be avoided?

Thanks

Hi @AdwinTrave ,
After some debugging looks loke the reason is, that after redirection I'm somehow loosing my $_SESSION with all the config data.
$_SESSION["HA::CONFIG"][$key] is empty after redirection to:
http://archivesupport.com/account/connect_end?hauth.start=Google&hauth.time=1428547607

Any thoughts?

Thanks

There seems to be some issue with Google in general, there are some efforts underway at HybridAuth to fix it. I'll let you know once I merge some improvements.

Thanks @AdwinTrave
Will wait for updates.
Meanwhile I did some changes in v1 google_connect controller, to work with 'https://github.com/google/google-api-php-client" library.
It actually fixed the "openid2 miggration" issue.
Would you like to see the code and do some code review, so we could push 'em to the master later?

Thanks

@samuelsh That sounds great! Submit a pull request. That is a best way to review code.