Create Instagram.php

This commit is contained in:
Sarah Tsumayoi 2017-11-28 14:27:59 -08:00 committed by GitHub
parent f6f3ec86c8
commit 1c96ffcc07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,65 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2017 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\user\authclient;
use yii\authclient\OAuth2;
class Instagram extends OAuth2
{
/**
* @inheritdoc
*/
protected function defaultViewOptions()
{
return [
'popupWidth' => 860,
'popupHeight' => 480,
'cssIcon' => 'fa fa-instagram',
'buttonBackgroundColor' => '#395697',
];
}
/**
* @inheritdoc
*/
public $authUrl = 'https://api.instagram.com/oauth/authorize';
/**
* @inheritdoc
*/
public $tokenUrl = 'https://api.instagram.com/oauth/access_token';
/**
* @inheritdoc
*/
public $apiBaseUrl = 'https://api.instagram.com/v1';
/**
* @inheritdoc
*/
protected function initUserAttributes()
{
$response = $this->api('users/self', 'GET');
return $response['data'];
}
/**
* @inheritdoc
*/
protected function apiInternal($accessToken, $url, $method, array $params, array $headers)
{
return $this->sendRequest($method, $url . '?access_token=' . $accessToken->getToken(), $params, $headers);
}
/**
* @inheritdoc
*/
protected function defaultName()
{
return 'instagram';
}
/**
* @inheritdoc
*/
protected function defaultTitle()
{
return 'Instagram';
}
}