2017 © Pedro Peláez
 

library oauth2-discord

OAuth2 client for authenticating with the Discord API servers

image

moutard3/oauth2-discord

OAuth2 client for authenticating with the Discord API servers

  • Thursday, August 10, 2017
  • by Moutard3
  • Repository
  • 2 Watchers
  • 1 Stars
  • 105 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 18 Forks
  • 0 Open issues
  • 4 Versions
  • 3 % Grown

The README.md

oauth2-discord

Build Status Coverage Status, (*1)

Provides Discord OAuth 2.0 support for PHP League's OAuth 2.0 Client., (*2)

Based on https://github.com/teamreflex/oauth2-discord, (*3)

Installation

Run composer require moutard3/oauth2-discord., (*4)

Usage

<?php

$provider = new \Discord\OAuth\Discord([
    'clientId'     => 'oauth-app-id',
    'clientSecret' => 'oauth-app-secret',
    'redirectUri'  => 'http://your.redirect.url',
]);

if (! isset($_GET['code'])) {
    echo '<a href="'.$provider->getAuthorizationUrl().'">Login with Discord</a>';
} else {
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code'],
    ]);

    // Get the user object.
    $user = $provider->getResourceOwner($token);

    // Get the guilds and connections.
    $guilds = $user->guilds;
    $connections = $user->connections;

    // Accept an invite
    $invite = $user->acceptInvite('https://discord.gg/0SBTUU1wZTUo9F8v');

    // Get a refresh token
    $refresh = $provider->getAccessToken('refresh_token', [
        'refresh_token' => $getOldTokenFromMemory->getRefreshToken(),
    ]);

    // Store the new token.
}

Credits

License

This code is subject to the MIT license which can be found in the LICENSE file., (*5)

The Versions

10/08 2017

dev-master

9999999-dev

OAuth2 client for authenticating with the Discord API servers

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Cole
by Alexandre Saillet

10/08 2017

1.1.1

1.1.1.0

OAuth2 client for authenticating with the Discord API servers

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Cole
by Alexandre Saillet

10/08 2017

1.1.0

1.1.0.0

OAuth2 client for authenticating with the Discord API servers

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Cole
by Alexandre Saillet

21/06 2016

v1.0

1.0.0.0

OAuth2 client for authenticating with the Discord API servers

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Cole