composer require chatwork/oauth2-chatwork
$provider = new ChatWorkProvider(
getenv('OAUTH2_CLIENT_ID'),
getenv('OAUTH2_CLIENT_SECRET'),
getenv('OAUTH2_REDIRECT_URI')
);
$url = $provider->getAuthorizationUrl([
'scope' => ['users.all:read', 'rooms.all:read_write']
]);
$accessToken = $provider->getAccessToken((string) new AuthorizationCode(), [
'code' => $code
]);
if ($accessToken->hasExpired()) {
$refreshedAccessToken = $provider->getAccessToken((string) new RefreshToken(), [
'refresh_token' => $accessToken->getRefreshToken()
]);
}
$resource_owner = $provider->getResourceOwner($accessToken);
An example of ChatWork OAuth2 client
チャットワークのOAuth2のクライアントをPHPで簡単に実装するためのライブラリを紹介
$ make test
The MIT License (MIT).