GithubHelp home page GithubHelp logo

facebook's Introduction

Opauth-Facebook

Opauth strategy for Facebook authentication.

Implemented based on https://developers.facebook.com/docs/authentication/

Getting started

  1. Install Opauth-Facebook:

    cd path_to_opauth/Strategy
    git clone https://github.com/opauth/facebook.git Facebook

    or

    composer require opauth/facebook
    
  2. Create Facebook application at https://developers.facebook.com/apps/

    • Remember to enter App Domains
    • "Website with Facebook Login" must be checked, but for "Site URL", you can enter any landing URL.
  3. Configure Opauth-Facebook strategy with at least App ID and App Secret.

  4. Direct user to http://path_to_opauth/facebook to authenticate

Strategy configuration

Required parameters:

<?php
'Facebook' => array(
	'app_id' => 'YOUR APP ID',
	'app_secret' => 'YOUR APP SECRET'
)

Even though fields is an optional configuration parameter for Opauth-Facebook, for most cases you would like to explicitly define it. It should be defined in a comma-separated string.

Refer to Facebook Fields Reference for list of valid fields.

License

Opauth-Facebook is MIT Licensed
Copyright © 2012 U-Zyn Chua (http://uzyn.com)

facebook's People

Contributors

henriquemattos avatar johannesx75 avatar laapsaap avatar leogermani avatar nielswerstreamtes avatar skennedy1492 avatar slavino avatar uzyn avatar whoami-anoint avatar yuzurus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

facebook's Issues

Add email scope to defaults

Since Facebook has changed Email as explicit param to be specified while making an API call. We should add it as default scope,

Change,

public $defaults = array(
    'redirect_uri' => '{complete_url_to_strategy}int_callback'
);

to

public $defaults = array(
    'redirect_uri' => '{complete_url_to_strategy}int_callback',
    'scope' => 'email'
);

Fatel Error : Config Parameter expected

Error: FacebookStrategy config parameter for "xxxxxxxxxxxxxxx" expected.
File: /var/www/surejobz/app/Plugin/Opauth/Vendor/Opauth/lib/Opauth/OpauthStrategy.php
Line: 201

Any idea why I am getting this error?

Incorrect GET variables

The class uses

$error = array(
    'provider' => $this->strategy['provider'],
    'code' => $_GET['error'],
    'message' => $_GET['error_description'],
    'raw' => $_GET

But Facebook seems to return 'error_code' and 'error_message'...

Facebook folder is ignored by git

Hello...

I have encountered this problem while using Opauth Facebook.

I cloned this repository into the Strategy folder just like what is instructed in README file.

However, the Facebook folder is seemed to be ignored by git.
I was not able to push it into my project.
I tried checking gitignore files, but it is not included in gitignore.

Can anyone help me regarding this issue? Thank you so much in advance!

Still alive?

Hello,

I am sorry to be the one asking it, but... is this strategy still working? Last update was 3 years ago.

Thank you,
Guido

Latest

Is this currently working? I don't seem to be able to get it running and see it was last updated 2 years ago? .. So is this the latest branch?

popin facebook strategy

Hi
I'd like to make the fb login in a popin format
but the current startegy takes me to FB login page
is there a different approach ?
Thanks for your help
Tibor

Documentation bug: setting variables

This code being posted at the top of the class PHP file doesn't work:
'Facebook' => array(
'app_id' => 'YOUR APP ID',
'app_secret' => 'YOUR APP SECRET'
)

Second connect

If we try to connect for the second time using Opauth for Facebook (when we already connected), to extend access token. Facebook won't return expires value.

FacebookStrategy.php:76 will return an error because expires is not set in results

Process 'middle_name' element

Some people have a middle_name, like me.

First name: Kees
middle name: van
Last name: Dieren

When I login using Facebook, the 'info' hash contains:

        [info] => Array
            (
                [name] => Kees van Dieren
                [image] => ...
                [nickname] => ....
                [first_name] => Kees
                [last_name] => Dieren
                [urls] => Array
                    (
                        [facebook] => ...
                    )

            )

The middle_name is not present in info.

Solutions could be:

  • add a middle_name key to info hash
  • add middle_name as suffix to last name, e.g. making last_name 'van Dieren'

'Undefined index: error' in FacebookStrategy.php:112

I just found this in my logs. Luckily, I logged the callback url so I guess fixing it should not be an issue.

"/opauth/facebook/int_callback?error_code=2&error_message=Sorry%2C+this+feature+isn%27t+available+right+now%3A+An+error+occurred+while+processing+this+request.+Please+try+again+later."

Use of this from within Closure

Seems there are two spots where you're using $this inside the closures.

Please use $that = $this; and then use($that) on the Closures.

Undefined index: expires @ line 77

After login i have this error :

[ Notice ]: Undefined index: expires
/vendor/opauth/lib/Opauth/Strategy/Facebook/FacebookStrategy.php @ line 77

It's at line 77.
For info, Twitter and Google opauth's work fine

Facebook Strategy

In the functionprivate function me it´s necessary put other parameter to get the email

$me = $this->serverGet('https://graph.facebook.com/me', array('access_token' => $access_token,'fields' => 'id,name,email' ), null, $headers);

Intermittent warning with file_get_contents() OpauthStrategy.php, line 402

Hello,

I have a strange problem using OpAuth's Facebook strategy.

The strategy works correctly, I can connect via Facebook, but sometime I get this warning:

Warning (2): file_get_contents(https://graph.facebook.com/oauth/access_token?client_id=xxxxxx&client_secret=xxxxxxxx&redirect_uri=http%3A%2F%2Fdev.example.com%2Fauth%2Ffacebook%2Fint_callback&code=AQD5Rkdrhw4J_VRxH72N4R3eWUTO_ItVnY7X3EvQ-f2hAiQboKPv4IHowpk4AU6JJX6wFUc0PnaaItYbeVKtm9uQVWdQdmgXFz47aNI5EtmP_QT8RJIfU35nmhSLzSSE9aH3NZBm0RngUeEyq8-hLOyyhUDZy1-qGZaWyBdzZ3p6aIF193y6TuOxfjYvZfaiz1BEY35HPASCvqb_u9fooOuJIqBCo3qtbS5wgwPbcD6dqE0k3D0WfPJCskYg3KfHYhdbGej1w8fzDJrRvpvpNrWPXw03-m2-Xauj3CtQLO5xxBmfbCRV2keonrg330uIHyk): failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request
 [APP/Plugin/Opauth/Vendor/Opauth/lib/Opauth/OpauthStrategy.php, line 402]
Code Context
file_get_contents - [internal], line ??
OpauthStrategy::httpRequest() - APP/Plugin/Opauth/Vendor/Opauth/lib/Opauth/OpauthStrategy.php, line 402
OpauthStrategy::serverGet() - APP/Plugin/Opauth/Vendor/Opauth/lib/Opauth/OpauthStrategy.php, line 353
FacebookStrategy::int_callback() - APP/Plugin/Opauth/Strategy/Facebook/FacebookStrategy.php, line 61
OpauthStrategy::callAction() - APP/Plugin/Opauth/Vendor/Opauth/lib/Opauth/OpauthStrategy.php, line 188
Opauth::run() - APP/Plugin/Opauth/Vendor/Opauth/lib/Opauth/Opauth.php, line 117
OpauthAppController::index() - APP/Plugin/Opauth/Controller/OpauthAppController.php, line 31
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 486
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 187
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 162
[main] - APP/webroot/index.php, line 92

Undefined index when Facebook gives an error

I recently discovered that this strategy does not work properly when Facebook returns an error.

The strategy expects URL parameters of "error" and "error_description" for its error information. However it seems that they have recently modified the parameter names, causing this error. So I needed a few modifications like below to get it fixed.

I hope it helps you :)

Cheers.

fuel/vendor/opauth/facebook/FacebookStrategy.php @ line 112
110            $error = array(
111                'provider' => 'Facebook',
112                'code' => $_GET['error_code'],        // replaced from "error"
113                'message' => $_GET['error_message'],  // replaced from "error_description"
114                'raw' => $_GET
115            );
Error Image

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.