Download the PHP package kayckmatias/discord-socialite-provider without Composer
On this page you can find all versions of the php package kayckmatias/discord-socialite-provider. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package discord-socialite-provider
Discord Socialite Provider for Laravel
A Discord OAuth2 provider for the Laravel Socialite package. This package allows you to easily integrate Discord login with Laravel applications using Socialite with extra features for Discord OAuth2.
Installation
-
Install the package via Composer:
-
Add the service provider to the config/app.php (only if you're using Laravel version <5.5 or not using package auto-discovery):
- Add your Discord credentials to the config/services.php file:
Configuration
You need to register your application with Discord to obtain the credentials required for OAuth2. You can register a new application at the Discord Developer Portal.
Once you have your credentials, add the following environment variables to your .env
file:
Usage
Once the package is installed and configured, you can use Discord as a provider with Laravel Socialite.
Example Redirecting to Discord
In your controller, use the Socialite facade to redirect the user to the Discord authentication page:
Handling the Callback
Once the user authorizes the app, Discord will redirect the user back to your application's callback URL. You can handle the callback and retrieve user information as follows:
Advanced Features
Custom Scopes
To request with custom scopes, you can use the setScopes
method:
Adding Permissions
To request additional permissions, you can use the withPermissions
method:
Bot Scopes
If you're working with a bot, you can use asBot
to bot scope instead default identify
scope:
Specify Guild
To add the guild_id=
parameter to the Discord authorization URL, use the withGuildId
method:
Consent Prompt
To add the prompt=none
parameter to the Discord authorization URL, use the withConsent
method:
License
This package is open-source and licensed under the MIT license.
More Information
For more information about Discord OAuth, please visit the Discord OAuth2 Documentation. For more information about Socialite, please visit the Socialite Documentation.
Issues
For any issues, feel free to open a ticket on the GitHub repository.