Skip to content

Commit

Permalink
improvement: remove with parameters #15
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkcup committed Feb 24, 2020
1 parent 7ee9d08 commit d57cebb
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions Coding/src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,13 @@ class Provider extends AbstractProvider
*/
protected $scopes = ['user'];

private $openId;

/**
* {@inheritdoc}
*/
protected function getAuthUrl($state)
{
// HACK: CODING 每个注册团队都是单独的二级域名,需要传递进来,目前发现有 with 和 guzzle 两种方法可以实现,这里选择 guzzle。
return $this->buildAuthUrlFromBase($this->guzzle['base_uri'] . 'oauth_authorize.html', $state);
return $this->buildAuthUrlFromBase($this->getTeamUrl() . 'oauth_authorize.html', $state);
}

/**
* {@inheritdoc}
*/
protected function getTeamUrl()
{
// HACK: CODING 每个注册团队都是单独的二级域名,需要传递进来,目前发现有 with 和 guzzle 两种方法可以实现。
$team = Arr::pull($this->parameters, 'team');
return "https://{$team}.coding.net/";
}

/**
Expand All @@ -45,8 +33,6 @@ protected function getTeamUrl()
protected function getTokenUrl()
{
return '/api/oauth/access_token';
$team = Arr::pull($this->parameters, 'team');
return $this->getTeamUrl() . 'api/oauth/access_token';
}

/**
Expand All @@ -68,7 +54,6 @@ protected function getUserByToken($token)
*/
protected function mapUserToObject(array $user)
{
\Log::error(__METHOD__, $user);
return (new User())->setRaw($user)->map([
'id' => $user['id'],
'nickname' => null,
Expand Down

0 comments on commit d57cebb

Please sign in to comment.