compwright/oauth2-servicetitan

为 PHP League OAuth2-Client 提供的 ServiceTitan OAuth 2.0 客户端提供商

1.0.1 2022-04-18 20:09 UTC

This package is auto-updated.

Last update: 2024-09-19 01:20:17 UTC


README

Latest Version Build Status Total Downloads

此包为 PHP League 的 OAuth 2.0 客户端 提供了 ServiceTitan OAuth 2.0 支持。

安装

要安装,请使用 composer

composer require compwright/oauth2-servicetitan league/oauth2-client

用法

用法与 The League 的 OAuth 客户端相同,使用 \Compwright\OAuth2_Servicetitan\Provider 作为提供商。

注意:对于 ServiceTitan 集成环境,请使用 \Compwright\OAuth2_Servicetitan\SandboxProvider 代替。

示例:授权码流

$provider = new Compwright\OAuth2_Servicetitan\Provider([
    'clientId'      => '{servicetitan-client-id}',
    'clientSecret'  => '{servicetitan-client-secret}',
    'redirectUri'   => 'https://example.com/callback-url'
]);

// Get an access token using the authorization code grant
$token = $provider->getAccessToken('client_credentials');

// Use the token to interact with an API on the users behalf
echo $token->getToken();

测试

$ composer run-script test

贡献

请参阅 CONTRIBUTING 获取详细信息。

致谢

许可协议

MIT 许可协议 (MIT)。请参阅 许可文件 获取更多信息。