Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
Remove username as a required credential for Instagram
Browse files Browse the repository at this point in the history
Default Instagram username to `self` unless ->setUsername() is specified
  • Loading branch information
Log1x committed Sep 10, 2018
1 parent 7ef873d commit 6352339
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ use SocialProof\SocialProof;

return SocialProof::social()
->instagram()
->setUsername('username')
->setToken('XXXXXXXXXXXXXXXXXXXXXXXX')
->get();
```
Expand Down
10 changes: 9 additions & 1 deletion src/Providers/Instagram.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,19 @@ class Instagram implements ProviderInterface
*/
protected $endpoint = '/v1/users/';

/**
* Default username for this provider.
*
* @var string
*/
protected $username = 'self';

/**
* Credentials required for this provider.
*
* @var array
*/
protected $credentials = [
'username',
'token'
];

Expand Down Expand Up @@ -66,6 +72,8 @@ public function get($credentials, $config)
$config->api = $config->api ?? $this->api;
$config->endpoint = $config->endpoint ?? $this->endpoint;

$credentials->username = $credentials->username ?? $this->username;

$instagram = $this->client($config)->getAsync($credentials->username, [
'query' => ['access_token' => $credentials->token]
])->then(
Expand Down

0 comments on commit 6352339

Please sign in to comment.