Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fordnox/zend_auth_adapter_facebook

Facebook oAuth2 Auth adapter for Zend Framework
https://github.com/fordnox/zend_auth_adapter_facebook

Last synced: 20 days ago
JSON representation

Facebook oAuth2 Auth adapter for Zend Framework

Awesome Lists containing this project

README

        

Zend_Auth_Adapter_Facebook
================

This repository contains the open source Facebook oAuth2 adapter for Zend Framework that allows you to utilize the
above on your website.

Author
-----

Author of this software is Andrius Putna
Released under Zend Framework license

Usage
-----

The [examples][examples] are a good place to start. The minimal you'll need to
have is:

..application/configs/application.ini

; ------------------------------------------
; Facebook
; ------------------------------------------
facebook.appId = ""
facebook.secret = ""
facebook.permissions = ""

..application/controller/AuthController.php

hasIdentity()) {
$this->_helper->redirector('index', 'profile');
}

$bootstrap = $this->getInvokeArg('bootstrap');
$array = $bootstrap->getOption('facebook');
$adapter = new Zend_Auth_Adapter_Facebook($array);
$token = $this->_getParam('code');

if($token) {
$adapter->setToken($token);
$result = $auth->authenticate($adapter);
if ($result->isValid()) {
$access_token = $result->getIdentity();
// do your stuff with access token
} else {
print $result->getMessages();
}
} else {
$adapter->redirect();
}
}
}

Feedback
--------

We are relying on the [GitHub issues tracker][issues] linked from above for
feedback. File bugs or other issues [here][issues].

[issues]: http://github.com/fordnox/Zend_Auth_Adapter_Facebook/issues