mirror of
https://github.com/humhub/humhub.git
synced 2025-02-24 19:23:21 +01:00
Create Instagram.php
This commit is contained in:
parent
f6f3ec86c8
commit
1c96ffcc07
65
protected/humhub/modules/user/authclient/Instagram.php
Normal file
65
protected/humhub/modules/user/authclient/Instagram.php
Normal 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';
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user