devtoolcz/discordtokenrevoke

OAUTH2 Revoking Token for Discord.

v2.1 2021-01-27 04:24 UTC

This package is auto-updated.

Last update: 2024-04-08 01:40:42 UTC


README

devtoolscz/discordtokenrevoke

Introduction Discord Revoke token is a small library for revoking token only for Discord OAUTH2 Applications. Example when user logout from page, we must revoke old token, for preventing leaking tokens. Library is created for Nette Framework.

VERSIONS

STATE VERSION BRANCH NETTE PHP
Dev 2.1 main 3.1 >=7.4
Old 2.0 main 3.0 >=7.2

Setup Recommended way to install is via composer.

composer require devtoolcz/discordtokenrevoke

extensions:
	revoke: Devtoolcz\Discordtokenrevoke\Nette\DI\RevokeExtension

Configuration

revoke:
    clientId: your discord application id
    clientSecret: your discord application secret key
    api_url: 'https://discord.com/api/v8'

Usage

use Nette;
use Devtoolcz\Discordtokenrevoke\DiscordRevoke;

final class ExamplePresenter extends Nette\Application\UI\Presenter
{

    /** @inject */
    private DiscordRevoke $discordRevoke;

    public function actionDiscordLogout()
    {
        $this->discordRevoke->createRevokeRequest('/oauth2/token/revoke')
            ->setToken('token here')->send();
    }
}