23 Jul 2018 Edited #1

Can't link existing account with facebook

Regular user
I can't link existing account with Facebook. My mybb version is 1.8.17 and plugin veriosn 3.3. Registration and loging works fine. When Im trying to link accounts I got: "Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request" error.

This is report code:
<?xml version="1.0" encoding="UTF-8"?>
<report name="MyFacebook Connect" version="3.3">
        <message>Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request</message>
        <trace> /home/sword/domains/odjechani.com.pl/public_html/myfbconnect/src/Facebook/FacebookResponse.php(210): Facebook\Exceptions\FacebookResponseException::create(Object(Facebook\FacebookResponse))
#1 /home/sword/domains/odjechani.com.pl/public_html/myfbconnect/src/Facebook/FacebookResponse.php(255): Facebook\FacebookResponse->makeException()
#2 /home/sword/domains/odjechani.com.pl/public_html/myfbconnect/src/Facebook/FacebookResponse.php(82): Facebook\FacebookResponse->decodeBody()
#3 /home/sword/domains/odjechani.com.pl/public_html/myfbconnect/src/Facebook/FacebookClient.php(224): Facebook\FacebookResponse->__construct(Object(Facebook\FacebookRequest), '{"error":{"mess...', 400, Array)
#4 /home/sword/domains/odjechani.com.pl/public_html/myfbconnect/src/Facebook/Authentication/OAuth2Client.php(277): Facebook\FacebookClient->sendRequest(Object(Facebook\FacebookRequest))
Flyover 2.3 /home/sword/domains/odjechani.com.pl/public_html/myfbconnect/src/Facebook/Authentication/OAuth2Client.php(226): Facebook\Authentication\OAuth2Client->sendRequestWithClientParams('/oauth/access_t...', Array)
Drafts AutoSave 1.1 /home/sword/domains/odjechani.com.pl/public_html/myfbconnect/src/Facebook/Authentication/OAuth2Client.php(166): Facebook\Authentication\OAuth2Client->requestAnAccessToken(Array)
ACP warning /home/sword/domains/odjechani.com.pl/public_html/myfbconnect/src/Facebook/Helpers/FacebookRedirectLoginHelper.php(228): Facebook\Authentication\OAuth2Client->getAccessTokenFromCode('AQAxklBAjudN9Xv...', 'https://odjecha...')
Issues setting up Flyover /home/sword/domains/odjechani.com.pl/public_html/inc/plugins/MyFacebookConnect/class_facebook.php(128): Facebook\Helpers\FacebookRedirectLoginHelper->getAccessToken('https://odjecha...')
Page is not found /home/sword/domains/odjechani.com.pl/public_html/inc/plugins/myfbconnect.php(484): MyFacebook->save_token()
Facebook and LinkedIn patches /home/sword/domains/odjechani.com.pl/public_html/inc/class_plugins.php(142): myfbconnect_usercp('')
Drafts AutoSave has been installed /home/sword/domains/odjechani.com.pl/public_html/usercp.php(61): pluginSystem->run_hooks(Array)
Flyover development {main}</trace>
Forum address is https://odjechani.com.pl
Shade 23 Jul 2018
Can you screenshot your FB app, specifically the OAuth redirect URI setting? Thank you.
Swordancer 23 Jul 2018 Edited
I remind you that it works with loging and registration. Only linking doesn't work.

[Image: quTDhsQ.png]
Shade 23 Jul 2018
Thank you. Try the following edit please.

File: inc/plugins/myfbconnect.php
Find (lines ~482-484):
if ($mybb->input['action'] == 'do_myfbconnect_link') {
Replace with:
if ($mybb->input['action'] == 'do_myfbconnect_link') {
And try linking your profile again.
Swordancer likes this post
Swordancer 23 Jul 2018
Thank you very much! It works just fine now. :)
Shade 23 Jul 2018
Thank you for your patience and testing. I will include the fix in the upcoming version 3.4.
Shade 23 Jul 2018
Can you please test the 3.4 release candidate? https://github.com/Shade-/MyFacebook-Connect I have included a slightly different and more elegant patch, but can't test it personally at the moment. You just need to replace the old files and run the upgrade script for the sake of updating the plugin's version in the cache.

Ensure you have a file and database backup before upgrading! :) Thank you!
Eldenroot 23 Jul 2018
So API 2.12 is the latest 2.x version of API, because another is v3.0, does it bring any improvement?

Can I enable "Enforce HTTPS" in Facebook dev for this app? Maybe the tutorial will need a small update.
Shade 24 Jul 2018
V3.0 introduces some changes in Facebook Login which need to be investigated - and I have no time at the moment to dig them deep.

Yes, Enforce HTTPS is highly recommended and supported by MFC. Just be sure to use https as redirect uris.