Hybrid Authentication With Facebook

1k Views Asked by At

I have been working on this for the past two days trying to get the facebook authentication using HybridAuth to work in codeigniter using https://github.com/andacata/HybridIgniter integration. The twitter authentication works fine but i get a user User has cancelled the authentication or the provider refused the connection when i try authorizing with facebook. When i directed to facebook from the site, it reads in the url that user has denied the application even before i enter my facebook details. This then return an empty user id to the application.

2

There are 2 best solutions below

0
On

It may be because Twitter is using Oauth1.0 while Facebook is using Oauth 2.0 for authentication. May be settings are not correct in your project.

0
On

When the authentication fail, you should call logout method.

$provider->logout();

then redirect again to the hibridy login. So all Cookies and Session var are reset and the user should be able to re-authorize the app.