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

Upgraded to HybridAuth 3.00 #87

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

bertrandgorge
Copy link
Contributor

@bertrandgorge bertrandgorge commented Aug 27, 2019

Upgraded to HybridAuth 3.00 (https://github.com/hybridauth/hybridauth/releases/tag/v3.0.0)

  • In order to smooth the upgrade / merge process, the old Hybrid (v2) folder has been replaced with HybridAuth (v3)

Overall, the upgrade was not too complicated, I didn't have to change to many things. One main issue was the "associate providers" process, which didn't seem to work on the first place, and was quite problematic because it would require a callback URL with parameters, which many providers don't provide anymore.

Upgrade notes:

  • The callback URLs have changed: it should now be the root of the Q2A installation (both with and without index.php - depending on if you use neat urls or not). Beware of http/https, you might need to declare them.
  • Users of the Donut Theme should upgrade to the latest version, as this release has been specifically tested against it. Their is a new option to use q2a-open-login with Donut, mainly to display the login buttons with bootstrap.

This patch has been tested against Twitter, Facebook and Google with success.

…e and Twitter

* Upgraded HybridAuth from "2.11.0" to "2.15.1"
* Added a specific endpoint for MS Live and Twitter (note that those endpoints need to be copied to the root of q2a)
* Added function qa_open_login_get_provider_scope in qa-open-utils, that returns the scope for each provider (the default scope for Google, Live, was way too permissive). This function is used in both qa_open-login.php and qa-open-page-logins.php (instead of being duplicated as it used to be for facebook). This fixes https://www.question2answer.org/qa/76682/login-google-login-remove-asking-permission-delete-contacts
Mainly so that when upgrading to an future version of HybridAuth we should not override this file. Should fix issue alixandru#53
* Removed Hybrid (v2)
* Added HybridAuth (v3) (without any changes)
* Started some adaptions - not working
* Replaced most of the code of check_login() with code taken from HybridAuth3 examples
* Fixed OP_baseSelected JS (used in user merge actions) so that it works with Donut theme (Donut replaces inputs with buttons)

Note: the logins page still needs fixing.
* Removed the possibility to add a provider to an existing account from the logins page - apparently this has never really worked, and if it did, it won't anymore because of the restrictions imposed by OAuth providers on callback URLs (and absence of paramenters). It is still possible to merge two accounts based on the email.
* Fixed the removal of a provider in the logins page
* Fixed the compatibility with Donut (although we should add a proper option for dealing with Donut) - Donut does not use inputs and links but only buttons.
* In the configuration form, removed the (obsolete) links to HybridAuth documentation - they were at best incomplete, outdated, and misleading. It's best for people to just google their provider and they shall find the correct answer.
* The default callback URL is now the root URL - although that might change depending on the way URL are shown (neat vs not neat). Added a second fallback URL with index.php. Also added a warning when using HTTPS and HTTP
* Added the icon of each provider in the admin form (that will work only if Bootstrap is enabled and the icon is declared in the CSS, which basically is the case with Donut)
* Included Bootstrap Social (see http://lipis.github.io/bootstrap-social/) - with a few changes to take precedence over Donut
* Added a specific option for using Donut, that actually triggers the use of bootstrap-social (for bc)
* Removed some specific code for Google button, that tend to mixup the style
@bertrandgorge
Copy link
Contributor Author

See: amiyasahu/Donut#110

…authentication screen

When cancelling the auth screen, we would be caught in an infinite loop, because a redirect would add the provider back in the URL, + the HybridAuth storage was not properly cleared.

Note that Google does not seem to provide a way to cancel/deny the auth screen, which is not too cool.
@alixandru
Copy link
Owner

Hello! Thanks again for the pull request. Due to the fact that I merged the other commits I need to manually fix the conflicts. I hope to be able to do that this weekend. I will get back to you soon.

@bertrandgorge
Copy link
Contributor Author

bertrandgorge commented Aug 31, 2019 via email

* Use Hybridauth\Storage\Session to store the redirection path during the connection process
* Also added the login buttons in the error HTML when on the ask form (if the form is not displayed because the user is not logged in)
Removed the buttons in the error message - this should not be done this way but by adding the widget in the "ask" question page.
@bertrandgorge
Copy link
Contributor Author

Hello @alixandru, have you add time to review the changes ? Tell me if I can be of any help!

@akien-mga
Copy link

akien-mga commented Oct 16, 2020

Hi there. We recently upgraded our q2a instance to 1.8.5 at https://godotengine.org/qa/ and it seems that Open Login broke. We tried latest master which includes parts of this PR but it seems to have been left in a non functional state, as having any provider enabled gives a redirect loop (we used to use Facebook and GitHub providers, and we mostly care about the latter).

@bertrandgorge Does the current state of your master branch (the base for this PR) work for you?

Since @alixandru merged a partial state manually, the best would likely be to create a new dedicated branch for a PR that would be rebased on alixandru/master.

We'd really love to have a functioning q2a-open-login matching latest q2a 1.8.5. Thanks!

@bertrandgorge
Copy link
Contributor Author

Hello @akien-mga ! I believe that this repo is not up to date with my last commits, probably because of me - my first attempts at providing a clean PR were not that great. You can check https://github.com/neayi/q2a-open-login as it functional for me and a bit ahead. Do not hesitate to contact me directly if you want to discuss it directly

@coelhorusso
Copy link

O plugin não está funcionando corretamente no Facebook e Google? Tem alguém usando com sucesso neles atualmente?

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

Successfully merging this pull request may close these issues.

None yet

4 participants