Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth requested url redirect problem #107

Open
monsurhoq opened this issue Jul 12, 2017 · 1 comment
Open

Auth requested url redirect problem #107

monsurhoq opened this issue Jul 12, 2017 · 1 comment

Comments

@monsurhoq
Copy link

monsurhoq commented Jul 12, 2017

I am facing redirect problem for google. For facebook, it's working. But for google it's display redirect_uri_mismatch error.

My AppController setup as below:

    $this->loadComponent ('TinyAuth.Auth', [
        'autoClearCache' => true,
        'authenticate' => [
             'Form' => [
                'finder' => 'auth'
             ],
             'ADmad/HybridAuth.HybridAuth' => [
                'fields' => [
                    'provider' => 'provider',
                    'openid_identifier' => 'openid_identifier',
                    'email' => 'email'
                ],
                'profileModel' => 'ADmad/HybridAuth.SocialProfiles',
                'profileModelFkField' => 'user_id',
                'userModel' => 'Users',
                'hauth_return_to' => null,
                'finder' => 'auth'
            ]
        ],
        'loginAction' => [
            'controller' => 'Users',
            'action' => 'login',
            'prefix' => false,
            'plugin' => false
        ],
        'loginRedirect' => [
            'controller' => 'Users',
            'action' => 'index',
            'prefix' => false,
            'plugin' => false
        ],
        'logoutRedirect' => [
            'controller' => 'Users',
            'action' => 'login',
            'prefix' => false,
            'plugin' => false
        ],
        'flash' => [
            'element' => 'error',
            'key' => 'auth'
        ],
        'authorize' => []
     ]);

My request URL as below:

     $this->Form->postLink (
         __('Login with Facebook'),
          ['controller' => 'Users', 'action' => 'login', '?' => ['provider' => 'Facebook', 'redirect' => $this->request->query('redirect')]]
     );
     $this->Form->postLink (
          __('Login with Google'),
         ['controller' => 'Users', 'action' => 'login', '?' => ['provider' => 'Google', 'redirect' => $this->request->query('redirect')]]
     );

I am using CakePHP version 3.4.10 and admad/cakephp-hybridauth version 4.1.1

@ADmad
Copy link
Owner

ADmad commented Jul 13, 2017

Yeah Google gets cranky if the callback URL isn't exactly the same as the one configured for it's Oauth2 service access. We would need to remove the appending of querystring to callback URL and instead rely on session to keep track of the redirect URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants