Download the PHP package rpurinton/discordoauth2 without Composer
On this page you can find all versions of the php package rpurinton/discordoauth2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download rpurinton/discordoauth2
More information about rpurinton/discordoauth2
Files in rpurinton/discordoauth2
Download rpurinton/discordoauth2
More information about rpurinton/discordoauth2
Files in rpurinton/discordoauth2
Vendor rpurinton
Package discordoauth2
Short Description A Discord OAuth2 Library for PHP
License MIT
Package discordoauth2
Short Description A Discord OAuth2 Library for PHP
License MIT
Please rate this library. Is it a good library?
Informations about the package discordoauth2
RPurinton Discord OAuth2 Library for PHP
Introduction
The RPurinton Discord OAuth2 Library is a PHP library designed to facilitate OAuth2 authentication with Discord. It provides functionality for obtaining and refreshing access tokens using Discord's API.
Installation
Composer Installation
To install the library, use Composer:
Configuration Setup
- Create a
config
directory at the same level as thevendor
directory. - Place the
DiscordOAuth2.json
file with your credentials in theconfig
directory.- Note: The
access_token
,refresh_token
, andexpires_at
will be added later by the library.
- Note: The
Discord Developer Portal Setup
- Create a Discord application in the Discord Developer Portal.
- Enable OAuth2 and set up the necessary redirect URIs.
- Obtain the client ID and client secret.
- Download the credentials JSON file and place it in the
config
directory asDiscordOAuth2.json
.
Usage
Initialization
- Create a new instance of the
DiscordOAuth2
class. - Run the
->init()
method to start the OAuth2 authentication flow. - This method will redirect to Discord for authentication and back to your script with the authorization code.
- The
init()
method is crucial for the first-time setup to obtain theaccess_token
andrefresh_token
. - These tokens are stored in the
DiscordOAuth2.json
configuration file. - Once the tokens are obtained, the
init()
method is not required again unless the user deauthorizes the app from their Discord account.
API Methods
init()
: Initiates the OAuth2 flow to obtain access and refresh tokens.refresh_token()
: Refreshes the access token using the refresh token.
Examples
Troubleshooting
- Ensure that the
DiscordOAuth2.json
file is correctly configured and accessible. - Verify that the Discord application is set up with the correct credentials and permissions.
- If you encounter issues with token expiration, ensure the
refresh_token
is valid and theinit()
method was successfully executed initially.
License
This library is licensed under the MIT License. See the LICENSE file for more information.
All versions of discordoauth2 with dependencies
PHP Build Version
Package Version
The package rpurinton/discordoauth2 contains the following files
Loading the files please wait ....