Jump to content
thejudge99

CONTRIBUTION Social Login with Facebook / Google 2.3.1/2

Recommended Posts

looks like you didnt put your keys and / or redirect urls into the relevant config files or you did but didnt upload them. Seeing error text from google in the form REDIRECT_URL means this is empty. This should literally contain a URL.

 

Jules

 

 

I think it was a mistyped url, but now I get this instead?

[b]Fatal error[/b]: Uncaught exception 'apiAuthException' with message 'Error fetching OAuth2 access token, message: 'invalid_grant'' in /home/XXXXXX/public_html/catalog/includes/google/src/auth/apiOAuth2.php:105 Stack trace: #0 /home/XXXXXX/public_html/catalog/includes/google/src/apiClient.php(138): apiOAuth2->authenticate(Array) #1 /home/XXXXX/public_html/catalog/googleloader.php(49): apiClient->authenticate() #2 {main} thrown in [b]/home/XXXXX/public_html/catalog/includes/google/src/auth/apiOAuth2.php[/b] on line [b]105[/b]

Edited by pederb

-Peder Beckman-

Kool Kat Jazz Records

Share this post


Link to post
Share on other sites

Nice work,

 

Can this be made admin compatible. That you only have to fill the API keys on the admin side. Not in de code. Same as URL?

 

Do not understand, sorry


-Peder Beckman-

Kool Kat Jazz Records

Share this post


Link to post
Share on other sites

@@mbuist - yes it could be easily made admin compatible - assuming you mean that the keys and all URLS are added in the backend.

 

@@pederb - that looks like the main google API causing probs - possibly caused by invalid data being put into the config file or you have corrupted 1 of the files in catalog/includes/google/src .

 

I would suggest restoring all those files again from the downloaded zip and "carefully" reinsert the keys / redirect url.

 

Jules

Share this post


Link to post
Share on other sites

Is this correct?

'oauth2_client_id' => '546413496****.apps.googleusercontent.com',

Insert between


-Peder Beckman-

Kool Kat Jazz Records

Share this post


Link to post
Share on other sites

Fatal error: Uncaught exception 'apiAuthException' with message 'Error fetching OAuth2 access token, message: 'invalid_grant'' in /home/***********/public_html/catalog/includes/google/src/auth/apiOAuth2.php:105 Stack trace: #0 /home/**********/public_html/catalog/includes/google/src/apiClient.php(138): apiOAuth2->authenticate(Array) #1 /home/**************/public_html/catalog/googleloader.php(49): apiClient->authenticate() #2 {main} thrown in /home/**********/public_html/catalog/includes/google/src/auth/apiOAuth2.php on line 105

 

Still get the same error when trying to login with Google and when trying with FB I get "An error occurred. Please try again later."

 

Please advice


-Peder Beckman-

Kool Kat Jazz Records

Share this post


Link to post
Share on other sites

@@pederb yes that looks right assuming you did client secret , redirect_url and developer+key the same way.

 

As for your error i have no idea- they are errors thrown by the api which is not coded by me. Which php version are you using ? ive only tested it with 5.2 - but i would assume it works on later versions.

 

You could try the latest api client http://code.google.com/p/google-api-php-client/downloads/list although looking at date im pretty sure my download zip contains the latest version.

 

Jules

 

ps. in that download package there are example scripts that run alone to check the loging in / extracting infos - give them a try to see if they run on your server.

Share this post


Link to post
Share on other sites

Jules,

 

Now it looks like not even registered customer can log on and buy products, I need help

 

Cheers


-Peder Beckman-

Kool Kat Jazz Records

Share this post


Link to post
Share on other sites

There are no changes made to the default way of logging in - and providing you have update 1.3 then creating accounts the old way will also work.

 

If however you are having other big problems then i suggest you restore everything with the backups you made before starting.

 

Jules

Share this post


Link to post
Share on other sites

Ok, I will do that, any chance off adding a Twitter login too?

 

Cheers


-Peder Beckman-

Kool Kat Jazz Records

Share this post


Link to post
Share on other sites

Can you tell me, if you know or have tested with Loaded Commerce 6.5.1a b2b?

 

Seems like just what i want, but want to make sure it is compatible before breaking something.

 

Thanks

Share this post


Link to post
Share on other sites

sorry ive no idea what that is so i cant say if its works. Assuming its an addon for oscommerce - this addon makes only minor ( mostly cosmetic) changes to main files and should work with most other addons.

 

Jules

Share this post


Link to post
Share on other sites

I am in the process of installing this for the first time by loading it into my sandbox. I am a little concerned by the 7 dwsync.xml files found in _notes folders in 7 locations. below are just 2 of the files and their content as examples.

 

catalog/_notes/dwsync.xml

<?xml version="1.0" encoding="utf-8" ?>
<dwsync>
<file name="googleloader.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129877090390519490" remote="129877855800000000" Dst="2" />
</dwsync>

 

catalog/includes/google/src/contrib/_notes/dwsync.xml

<?xml version="1.0" encoding="utf-8" ?>
<dwsync>
<file name="apiAnalyticsService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiAdsenseService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiBigqueryService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiBloggerService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiCustomsearchService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiFreebaseService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiBooksService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiCalendarService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiLatitudeService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiGanService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiOauth2Service.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiPagespeedonlineService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiModeratorService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiPredictionService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiPlusService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiOrkutService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiSiteVerificationService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiShoppingService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiTasksService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiTranslateService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiUrlshortenerService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiWebfontsService.php" server="www.conzept.de/oscommerce_3.02/" local="129755636660000000" remote="129876282600000000" Dst="2" />
<file name="apiAdsenseService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiAnalyticsService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiBigqueryService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiBloggerService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiCustomsearchService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiBooksService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiCalendarService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiFreebaseService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiLatitudeService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiOauth2Service.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiGanService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiPagespeedonlineService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiModeratorService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiPredictionService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiPlusService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiOrkutService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiSiteVerificationService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiShoppingService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiTasksService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiTranslateService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiUrlshortenerService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
<file name="apiWebfontsService.php" server="www.conzept.de/oscommerce_2.3.1_raw/catalog/" local="129755636660000000" remote="129877855800000000" Dst="2" />
</dwsync>

 

I intend to delete all of these files before uploading as they contain references to another domain. This raises 2 questions.

  1. Will this break my sandbox install?
  2. Why were they included in the first place?

Q1 - should I upload a zero byte file instead? Do I need a _notes folder in the first place?

 

Thanks,

Paul.

Share this post


Link to post
Share on other sites

Sorry for the double post but this issue has come up after creating both APIs.

1) BACKUP your existing oscommerce database and the modified files listed above

1a) 2.3.2 users can proceed to 2)

1b) 2.3.1 users open the files uploads/catalog/googleloader.php and uploads/includes/login-facebook.php and search for

 

//2.3.1

 

Unhide the query below( by removing the // ) and Hide the query above( add // )

 

I am running 2.2 RC2a so will it work at all? If so, which query is suitable?

 

Thanks (again),

Paul.

Share this post


Link to post
Share on other sites

the dwsync files / _notes folders you can safely delete - sorry i never noticed them. These are automatically generated by Abode Dreamweaver.

 

Quote from adobe help

 

When you put or get a file in Adobe Dreamweaver CS4 and CS5, Dreamweaver locally stores the remote and local date/time stamps in files called dwsync.xml, which are located in hidden _notes folders in the same folder as the files being transferred.

 

Seems all my uploaded zips will probably contain these files.

 

As for 2.2 compatibility - i cannot say - this was written for 2.3.1 and above.

 

Jules

Share this post


Link to post
Share on other sites

@Mention Thank you for that. 6/7 are in catalog/includes/google/src which appears to contain a lot of irrelevant files. is catalog/includes/google even needed?

 

I have managed to eventually get the login.php to show/use the buttons by moving the code below

  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main" width="50%" valign="top"><b><?php echo HEADING_NEW_CUSTOMER; ?></b></td>
		<td class="main" width="50%" valign="top"><b><?php echo HEADING_RETURNING_CUSTOMER; ?></b></td>
<?

 

Unfortunately checkout_shipping.php is causing problems as 2.2 RC2a does not contain any of the code referred to in the instructions. I gather the new code is an account verification/redirection but, as my PHP is not at all good, am not sure where to insert the new code. I am pretty sure it needs to go in the following section. Can I be cheeky and ask how :blush:

 require('includes/application_top.php');
 require('includes/classes/http_client.php');
// if the customer is not logged on, redirect them to the login page
 if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }
// if there is nothing in the customers cart, redirect them to the shopping cart page
 if ($cart->count_contents() < 1) {
tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 }
// if no shipping destination address was selected, use the customers own address as default
 if (!tep_session_is_registered('sendto')) {
tep_session_register('sendto');
$sendto = $customer_default_address_id;
 } else {
// verify the selected shipping address
if ( (is_array($sendto) && empty($sendto)) || is_numeric($sendto) ) {
  $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'");
  $check_address = tep_db_fetch_array($check_address_query);
  if ($check_address['total'] != '1') {
	$sendto = $customer_default_address_id;
	if (tep_session_is_registered('shipping')) tep_session_unregister('shipping');
  }
}
 }
 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

Thanks,

Paul.

Share this post


Link to post
Share on other sites

the entire google folder is part of the google api - not coded by me - if you want to login with google then you will need it.

 

The changes to checkout_shipping.php is there to prevent ordering until all needed infos are taken - with the social logins its only possible to obtain first /lastname + email . That part you can change to suit your own needs.

 

Jules

Share this post


Link to post
Share on other sites

Receiving the following on regular account creation. Double checked my 14a, 14b, and 14c instructions and they match the install instructions.

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1,1' at line 1

 

insert into customers_info (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created, valid_address, personal_details_valid) values ('3', '0', now()),1,1

 

 

Code that was used on create_account.php:

// social login start

tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created, valid_address, personal_details_valid) values ('" . (int)$customer_id . "', '0', now()),1,1");

// social login end

 

 

Facebook and Google logins both work. Thank you for the contribution!


Doug

Share this post


Link to post
Share on other sites

update 1.3 addresses this problem - which is

 

// social login start
tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created, valid_address, personal_details_valid) values ('" . (int)$customer_id . "', '0', now(),1,1)");
// social login end

 

Jules

Share this post


Link to post
Share on other sites

hi!Julian i try integrate oscommerce 2.3.3 with fb and google login downloaded from http://addons.oscommerce.com/info/8509

the most early version dated 26 Jul 2012.

There are a lot of errors

1) I don't even see the fb and google login button at login.php at your demo.

2)In the install.html , 14d) , which file i should find <head/> for me paste the code above it? at login.php ?

3)"Note: the slide effect is not included in the standard jQuery Tools distribution. You must download a custom combination that includes this effect.

Here: http://jquerytools.github.com/download/index.html#combine"

 

Do i need to download above jQ as descript in install.html, in order make the login to work or just a optional ?

 

Please visit my beta web http://lulugift.com/lg2/login.php

Please advice

Share this post


Link to post
Share on other sites

Dears,

I also have this issue after I install this module. any suggestion?

 

Thanks & Best Regards,

Sunrise99

post-186794-0-68857300-1351068454_thumb.jpg

Edited by sunrise99

Share this post


Link to post
Share on other sites

the dwsync files / _notes folders you can safely delete - sorry i never noticed them. These are automatically generated by Abode Dreamweaver.

 

Quote from adobe help

 

When you put or get a file in Adobe Dreamweaver CS4 and CS5, Dreamweaver locally stores the remote and local date/time stamps in files called dwsync.xml, which are located in hidden _notes folders in the same folder as the files being transferred.

 

Seems all my uploaded zips will probably contain these files.

 

As for 2.2 compatibility - i cannot say - this was written for 2.3.1 and above.

 

Jules

 

 

This module can work under osc2.2 RC2A , I have install on one site. But need note some code different. Little change

Share this post


Link to post
Share on other sites

@ tomchew if you cannot see the login buttons on my demo page then there is something wrong with your browser or you have something very old -assuming you are looking at this page http://ocraw.conzept.de/login.php

 

i cannot find 14d in my install - unless you refer to the latest update with sexy tooltip - that i didnt do so i cannot say. but <head> is usually found in template_top.php

 

My version uses jquery only to make a popup appear - no animations made whatsover.

 

 

@@sunrise - cannot say without more info but it looks like a mismatch in the google configuration.

 

Jules

Edited by thejudge99

Share this post


Link to post
Share on other sites

@@tomchew your logins page html looks broken - your entire right column has disapeared. The changes to login.php with my addon are (mostly) cosmetic changes - I would suggest you restore to the backup you made before starting and go through the changes again carefully.

 

Jules

Share this post


Link to post
Share on other sites

Hi Jules! I've been implementing your addon and I've bumped into a few problems:

1 Google inlog button is not available - I've rechecked the code three times and I can't seem to find the culprit

2 Closing the popup window - refresh the parent window - it now just opens the popup and redirects to the account page there. I've been fiddling with the code, but my programming skills are quite rusty :-

 

Could you (or someone who has already figured out the problem) check to see what I did wrong?

 

www.vida-voer.nl/shop/login.php

 

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×