PHP Classes

File: examples/facebook.php

Recommend this page to a friend!
  Classes of Daniel  >  ohmy-auth  >  examples/facebook.php  >  Download  
File: examples/facebook.php
Role: Example script
Content type: text/plain
Description: Example script
Class: ohmy-auth
Obtain authorization to access APIs using OAuth
Author: By
Last change: added leg static function; organized http and sesssion code into components
Date: 8 months ago
Size: 1,120 bytes


Class file image Download
<?php require_once __DIR__ . '/../vendor/autoload.php';

 * Copyright (c) 2014, Yahoo! Inc. All rights reserved.
 * Copyrights licensed under the New BSD License.
 * See the accompanying LICENSE file for terms.

use ohmy\Auth2;

# initialize 3-legged oauth
$facebook = Auth2::legs(3)
'id' => 'your client id',
'secret' => 'your client secret',
'redirect' => 'your redirect uri',
'scope' => 'read_stream'

# oauth flow
finally(function($data) use(&$access_token) {
$access_token = $data['access_token'];

# test GET call
then(function($response) {

For more information send a message to info at phpclasses dot org.