Hi all!

Thanks for this great module!

I'm having some problems on a multilingual site. There are different domains to different languages:
English language uses domain_en.com ( english is the default language ) and Hungarian language uses domain_hu.hu.

The english site works perfect, but hungarian produces magic errors. The main error is:
Fatal error: Class 'Hybrid_Logger' not found in .../sites/all/libraries/hybridauth/hybridauth/Hybrid/Endpoint.php on line 202

I found so, if i try to log in to hungarian site than there are mixed domain names in the $_SESSION['HA::CONFIG'] and $_SESSION['HA::STORE'] variables ( e.g. in $_SESSION['HA::STORE']['hauth_session.google.hauth_endpoint'] is http://domain_en/hybridauth/endpoint... )

E.g. in hybridauth_get_config() function:

$config = array(
      'base_url' => url('hybridauth/endpoint', array('absolute' => TRUE, 'language' => _hybridauth_language_default())),
      ...

If i hack the _hybridauth_language_default() function and change this {

$language_default = language_default();

to this:

global $language;
$language_default = $language;

than the hungarian logins work perfectly too

Comments

fox mulder’s picture

Issue summary: View changes
duozersk’s picture

fox mulder,

Thank you for using the module and for the report.

I'm not really sure I understand this completely... I do know that some social authentication providers require that the "redirect URL" supplied as a parameter of the request is the same as it was set for the application on the provider side. And so if you have different domains for the English and Hungarian languages then it would produce different "redirect URL" for every domain - so you should probably have different applications for every domain - meaning different provider settings (application ID/secret, etc.) - is that correct?

I'm ready to commit your change, just need to be sure we do understand how it should perform.

Thanks
AndyB

fox mulder’s picture

"And so if you have different domains for the English and Hungarian languages then it would produce different "redirect URL" for every domain - so you should probably have different applications for every domain - meaning different provider settings (application ID/secret, etc.) - is that correct?"

Yes, it's correct. ...at least that's how i did it.

duozersk’s picture

fox mulder,

OK, got it. Just one more question - are you using some custom code to create the application settings variables per domain? I would love to see this code to include it into the project. There is an issue here where another person shared some lines of code for this - have't been able to go through it yet.

Thanks
AndyB

  • duozersk committed f109360 on 7.x-2.x
    Fixed [#2478803] by fox mulder - changed language_default() to global...
duozersk’s picture

Status: Active » Fixed
fox mulder’s picture

duozersk,

Yes it's needed to implementing hook_variable_info() to publish hybridauth variables on admin/config/regional/i18n/variable admin page ( created by i18n_variable module ( part of i18n module ) ):

/**
 * Implements hook_variable_info().
 */
function MYMODULE_variable_info($options) {
  $variables['hybridauth_provider_Facebook_keys_id'] = array(
    'title' => t('Facebook App ID'),
    'description' => t('Facebook App ID'),
    'localize' => TRUE
  );
  $variables['hybridauth_provider_Facebook_keys_secret'] = array(
    'title' => t('Facebook App Secret'),
    'description' => t('Facebook App Secret'),
    'localize' => TRUE
  );
  $variables['hybridauth_provider_Google_keys_id'] = array(
    'title' => t('Google App ID'),
    'description' => t('Google App ID'),
    'localize' => TRUE
  );
  $variables['hybridauth_provider_Google_keys_secret'] = array(
    'title' => t('Google App Secret'),
    'description' => t('Google App Secret'),
    'localize' => TRUE
  );
  return $variables;
}

It's not the best solution because if i enable a new provider on admin/config/people/hybridauth page than i should extend the hook_variable_info() implementation manually

fox mulder’s picture

PS:

The solution above matches if the different domains depend on languages. If the different domains are created by domain access module than it's another case ( i think so )...

PS II.: hmmm... the main question is here the different domain not the different languages, isn't it?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.