Skip to content

chatwork/oauth2-chatwork-php

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 

ChatWork Provider for OAuth 2.0 Client

Build Status Latest Stable Version License

Installation

composer require chatwork/oauth2-chatwork

Usage

Get our consent page URL

$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']
]);

Get an access token

$accessToken = $provider->getAccessToken((string) new AuthorizationCode(), [
    'code' => $code
]);

Refresh a token

if ($accessToken->hasExpired()) {
    $refreshedAccessToken = $provider->getAccessToken((string) new RefreshToken(), [
        'refresh_token' => $accessToken->getRefreshToken()
    ]);
}

Get resource owner's profile

$resource_owner = $provider->getResourceOwner($accessToken);

Example

An example of ChatWork OAuth2 client

ChatWork OAuth2.0 document

API Document

Blog

チャットワークのOAuth2のクライアントをPHPで簡単に実装するためのライブラリを紹介

Contributing

Testing

$ make test

License

The MIT License (MIT).