Skip to content

Commit

Permalink
Merge pull request #27 from youzan/feature/support_youzanke_and_platf…
Browse files Browse the repository at this point in the history
…orm_app

支持有赞客应用与平台型应用
  • Loading branch information
xu42 committed Mar 12, 2020
2 parents 8c367cf + ad0076e commit b87e369
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/Open/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,43 @@ public function getToolAppToken($code, $config = [])
return $this->exec($params, $config);
}

/**
* 有赞客应用获取Token
*
* @param int|string $authorityId
* @param array $config
* @return mixed
*/
public function getYouzanKeAppToken($authorityId, $config = [])
{
$params = [
'authorize_type' => 'silent',
'grant_id' => $authorityId,
'grant_type' => 'youzanke',
'refresh' => array_key_exists('refresh', $config) ? boolval($config['refresh']) : false,
];

return $this->exec($params, $config);
}

/**
* 平台型应用获取Token
*
* @param int|string $authorityId
* @param array $config
* @return mixed
*/
public function getPlatformAppToken($authorityId, $config = [])
{
$params = [
'authorize_type' => 'certificate',
'grant_id' => $authorityId,
'refresh' => array_key_exists('refresh', $config) ? boolval($config['refresh']) : false,
];

return $this->exec($params, $config);
}

/**
* 刷新Token(通过refreshToken刷新Token)
*
Expand Down

0 comments on commit b87e369

Please sign in to comment.