revolution/socialite-chatwork

This package is abandoned and no longer maintained. No replacement package was suggested.

Socialite for ChatWork

1.2.2 2020-03-04 13:50 UTC

This package is auto-updated.

Last update: 2024-03-15 11:52:29 UTC


README

http://developer.chatwork.com/ja/

Requirements

  • PHP >= 7.2

Installation

composer require revolution/socialite-chatwork

config/services.php

    'chatwork' => [
        'client_id'     => env('CHATWORK_CLIENT_ID'),
        'client_secret' => env('CHATWORK_CLIENT_SECRET'),
        'redirect'      => env('CHATWORK_REDIRECT'),
    ],

.env

CHATWORK_CLIENT_ID=
CHATWORK_CLIENT_SECRET=
CHATWORK_REDIRECT=

Usage

routes/web.php

Route::get('login', 'ChatWorkController@login');
Route::get('callback', 'ChatWorkController@callback');

ChatWorkController

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Socialite;

class ChatWorkController extends Controller
{
    public function login()
    {
        return Socialite::driver('chatwork')->redirect();
    }

    public function callback()
    {
        $user = Socialite::driver('chatwork')->user();
        dd($user);
    }
}

Scopes

http://developer.chatwork.com/ja/oauth.html#secAppendix

    public function login()
    {
        return Socialite::driver('chatwork')
                        ->setScopes(['users.all:read'])
                        ->redirect();
    }

Demo

https://github.com/kawax/socialite-project

LICENCE

MIT Copyright kawax