Permalink
Browse files

Added preliminary Blooie driver.

  • Loading branch information...
1 parent 86cf60c commit 4e8feeb553755ca638ba3f4bf2b694758849de2b Phil Sturgeon committed Apr 3, 2012
Showing with 55 additions and 0 deletions.
  1. +55 −0 classes/provider/blooie.php
@@ -0,0 +1,55 @@
+
+<?php
+/**
+ * Blooie OAuth2 Provider
+ *
+ * @package FuelPHP/OAuth2
+ * @category Provider
+ * @author Phil Sturgeon
+ * @copyright (c) 2012 HappyNinjas Ltd
+ * @license http://philsturgeon.co.uk/code/dbad-license
+ */
+
+namespace OAuth2;
+
+class Provider_Blooie extends Provider
+{
+ public $scope = array('user.profile', 'user.picture');
+
+ public $method = 'POST';
+
+ public function url_authorize()
+ {
+ return 'http://local.bloo.ie/oauth';
+ }
+
+ public function url_access_token()
+ {
+ return 'http://local.bloo.ie/oauth/access_token';
+ }
+
+ public function get_user_info(Token_Access $token)
+ {
+ $url = 'https://graph.facebook.com/me?'.http_build_query(array(
+ 'access_token' => $token->access_token,
+ ));
+
+ $user = json_decode(file_get_contents($url));
+
+ // Create a response from the request
+ return array(
+ 'uid' => $user->id,
+ 'nickname' => $user->username,
+ 'name' => $user->name,
+ 'first_name' => $user->first_name,
+ 'last_name' => $user->last_name,
+ 'email' => isset($user->email) ? $user->email : null,
+ 'location' => isset($user->hometown->name) ? $user->hometown->name : null,
+ 'description' => isset($user->bio) ? $user->bio : null,
+ 'image' => 'https://graph.facebook.com/me/picture?type=normal&access_token='.$token->access_token,
+ 'urls' => array(
+ 'Facebook' => $user->link,
+ ),
+ );
+ }
+}

0 comments on commit 4e8feeb

Please sign in to comment.