Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12694 anikendra 1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
/**
3
 * Instagram OAuth2 Provider
4
 *
5
 * @package    CodeIgniter/OAuth2
6
 * @category   Provider
7
 * @author     Phil Sturgeon
8
 * @copyright  (c) 2012 HappyNinjas Ltd
9
 * @license    http://philsturgeon.co.uk/code/dbad-license
10
 */
11
 
12
class OAuth2_Provider_Instagram extends OAuth2_Provider
13
{
14
	/**
15
	 * @var  string  scope separator, most use "," but some like Google are spaces
16
	 */
17
	public $scope_seperator = '+';
18
 
19
	/**
20
	 * @var  string  the method to use when requesting tokens
21
	 */
22
	public $method = 'POST';
23
 
24
	public function url_authorize()
25
	{
26
		return 'https://api.instagram.com/oauth/authorize';
27
	}
28
 
29
	public function url_access_token()
30
	{
31
		return 'https://api.instagram.com/oauth/access_token';
32
	}
33
 
34
	public function get_user_info(OAuth2_Token_Access $token)
35
	{
36
		$user = $token->user;
37
 
38
		return array(
39
			'uid' => $user->id,
40
			'nickname' => $user->username,
41
			'name' => $user->full_name,
42
			'image' => $user->profile_picture,
43
			'urls' => array(
44
			  'website' => $user->website,
45
			),
46
		);
47
	}
48
}