Giter Club home page Giter Club logo

Comments (4)

ikkez avatar ikkez commented on August 12, 2024

Looks like you have not included the fat free base.php, which is the required for all plugins of cause.

from f3-opauth.

rontornambe avatar rontornambe commented on August 12, 2024

Here's my code:

require "php/f3-oauth/OpauthBridge.php";
$f3 = require('php/fatfree-master/lib/base.php');
$f3->set('AUTOLOAD','php/f3-oauth/'); // add the opauth path to the autoload
$f3->config('php/f3-oauth/opauth.ini', true);
$opauth =OpauthBridge::instance($f3->opauth);
header('Location:http://writers-tryst.ron-tornambe.com/auth/facebook');
// define login handler
$opauth->onSuccess(function($data){
header('Content-Type: text');
echo 'User successfully authenticated.'."\n";
print_r($data['info']);
});
// define error handler
$opauth->onAbort(function($data){
header('Content-Type: text');
echo 'Auth request was canceled.'."\n";
print_r($data);
});
$f3->run();
?>

I would much appreciate it if you would include a code sample for
calling logging in and calling facebook. Can I assume the domain.com
is the domain requesting authentication?

On Fri, Jun 10, 2016 at 3:46 PM, Christian Knuth [email protected]
wrote:

Looks like you have not included the fat free base.php, which is the
required for all plugins of cause.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#3 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAraSaN-xgSvtlaQ0snofcuPRoyX3em9ks5qKb8jgaJpZM4Iy9hj
.

from f3-opauth.

ikkez avatar ikkez commented on August 12, 2024

The code is unreadable.. would you kindly add the proper formatting syntax to code samples next time? It's 3x backticks ( ` ) before and after the code block.

why did you add the header location redirect? It cannot work this way. You have to use that link on a button in your frontend somewhere, otherwise the auth process can never complete, since the user is redirected back to your site after authentication, which would initiate other auth again and end in a loop.

Do not require the opauthbride.php file. The autoloader should load it.
Loading any plugin before you require the base.php is no good idea either.

This is the full sample:

<?php
$f3 = require('php/fatfree-master/lib/base.php');
$f3->set('AUTOLOAD','php/f3-oauth/'); 
$f3->config('php/f3-oauth/opauth.ini', true);
$opauth =OpauthBridge::instance($f3->opauth);
$opauth->onSuccess(function($data){
    header('Content-Type: text');
    echo 'User successfully authenticated.'."\n";
    print_r($data['info']);
});
$opauth->onAbort(function($data){
    header('Content-Type: text');
    echo 'Auth request was canceled.'."\n";
    print_r($data);
});
$f3->route('GET /',function(){
  echo "hallo";
});
$f3->run();
?>

Now go to your project, see if you get "hallo". Now add auth/facebook to start the auth with facebook or auth/github for the github provider. I recommend that you create your own apps, and put the new keys and secrets into the config file. the strategy docs have at least a link where you can find the dev tools for each provider to create and setup that apps / api keys.

from f3-opauth.

rontornambe avatar rontornambe commented on August 12, 2024

Thanks so much for putting up with me. I finally got it working.

On Sat, Jun 11, 2016 at 11:54 AM, Christian Knuth [email protected]
wrote:

The code is unreadable.. would you kindly add the proper formatting syntax
to code samples next time? It's 3x backticks ( ` ) before and after the
code block.

why did you add the header location redirect? It cannot work this way. You
have to use that link on a button in your frontend somewhere, otherwise the
auth process can never complete, since the user is redirected back to your
site after authentication, which would initiate other auth again and end in
a loop.

Do not require the opauthbride.php file. The autoloader should load it.
Loading any plugin before you require the base.php is not good idea either.

This is the full sample:

set('AUTOLOAD','php/f3-oauth/'); $f3->config('php/f3-oauth/opauth.ini', true);$opauth =OpauthBridge::instance($f3->opauth);$opauth->onSuccess(function($data){ header('Content-Type: text'); echo 'User successfully authenticated.'."\n"; print_r($data['info']);});$opauth->onAbort(function($data){ header('Content-Type: text'); echo 'Auth request was canceled.'."\n"; print_r($data);});$f3->route('GET /',function(){ echo "hallo";});$f3->run();?>

Now go to your project, see if you get "hallo". Now add auth/facebook to
start the auth with facebook or auth/github for the github provider. I
recommend that you create your own apps, and put the new keys and secrets
into the config file. the strategy docs have at least a link where you can
find the dev tools for each provider to create and setup that apps / api
keys.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#3 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAraSfxmeEuU9H4OlrWz_c9Th32c6Eccks5qKtpBgaJpZM4Iy9hj
.

from f3-opauth.

Related Issues (7)

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.