Comments (4)
Looks like you have not included the fat free base.php, which is the required for all plugins of cause.
from f3-opauth.
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.
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.
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)
- refresh token ? HOT 2
- Please explain to a novice PHP developer how to implement this plugin. HOT 10
- Documentation incomplete HOT 3
- Can you give an example to work within other controller? HOT 4
- Creation of dynamic property Opauth::$Strategy is deprecated
- Github Strategy: Must specify access token via Authorization header HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from f3-opauth.