Token.php 744 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace app\extra\dyLife;
  3. use yzh52521\EasyHttp\Http;
  4. class Token extends BasicLife
  5. {
  6. /**
  7. * 获取AccessToken
  8. * https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/server/basic-abilities/interface-request-credential/non-user-authorization/get-client_token
  9. * @param string $grantType
  10. * @return array
  11. */
  12. public function getAccessToken(string $grantType = 'client_credential'): array
  13. {
  14. $data = [
  15. "client_key" => $this->config['appid'],
  16. "client_secret" => $this->config['secret'],
  17. "grant_type" => $grantType
  18. ];
  19. return $this->curlPostApi("oauth/client_token/",$data);
  20. }
  21. }