simonkub / oauth2-todoist
This package provides Todoist OAuth 2.0 support for the PHP League's OAuth 2.0 Client.
1.0.0
2020-12-17 16:02 UTC
Requires
- php: ^7.4|^8.0
- ext-json: *
- league/oauth2-client: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- mockery/mockery: ^1.4
- phpunit/phpunit: ^9.3
README
Todoist Sync API OAuth 2.0 support for the PHP League's OAuth 2.0 Client.
Installation
You can install the package via composer:
composer require simonkub/oauth2-todoist
Usage
// configure and create client $client = new Simonkub\OAuth2\Client\Todoist([ "clientId" => "CLIENT_ID", "clientSecret" => "CLIENT_SECRET", "redirectUri" => "REDIRECT_URI" ]); // optionally set client scopes, defaults to "data:read" $client->setDefaultScopes(["data:read"]); // redirect to todoist login page $loginPageUri = $client->getAuthorizationUrl(); // after login and beeing redirected back to your application // read authorization code from request $authorizationCode = $_GET['code']; // exchange authorization code for token $token = $client->getAccessToken("authorization_code", [ "code" => $authorizationCode ]); // read single resource $response = $client->readResource("projects", $token); // read multiple resources $response = $client->readResources(["projects", "labels"], $token); // write resource $commands = [ "type" => "item_add", "uuid" => uniqid(), "temp_id" => uniqid(), "args" => [ "project_id" => "foo", "content" => "bar" ] ]; $response = $client->writeResources($commands, $token);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.