evopixel / socialiteproviders-minecraft-evopixel
Minecraft EvoPixel OAuth2 provider for Laravel Socialite
Package info
github.com/evopixelro/socialiteproviders-minecraft-evopixel
pkg:composer/evopixel/socialiteproviders-minecraft-evopixel
Requires
- php: ^7.4 || ^8.0
- socialiteproviders/manager: ^4.3
Requires (Dev)
- illuminate/session: ^8.83 || ^9.0 || ^10.0 || ^11.0 || ^12.0
- mockery/mockery: ^1.6
- phpunit/phpunit: ^9.6
Suggests
None
Provides
None
Conflicts
- laravel/socialite: <5.2.1
Replaces
None
README
Minecraft EvoPixel OAuth2 provider for Laravel Socialite
This provider authenticates Minecraft EvoPixel accounts. It does not authenticate Microsoft or Mojang accounts.
composer require evopixel/socialiteproviders-minecraft-evopixel
Installation & Basic Usage
Please see the Base Installation Guide, then follow the provider specific instructions below.
Requires PHP 7.4 or 8.x and SocialiteProviders Manager 4.3 or later within 4.x. Manager installs Laravel Socialite automatically; versions older than 5.2.1 are excluded because this provider requires PKCE.
Add configuration to config/services.php
'mcevo' => [ 'client_id' => env('MINECRAFT_EVOPIXEL_CLIENT_ID'), 'client_secret' => env('MINECRAFT_EVOPIXEL_CLIENT_SECRET'), 'redirect' => env('MINECRAFT_EVOPIXEL_REDIRECT_URI'), ],
Use the credentials and callback URL registered for your application with Minecraft EvoPixel. The client secret must contain at least 32 bytes, and the callback must exactly match the registered HTTPS URL. The provider defines its OAuth endpoints; no issuer configuration is required.
Add provider event listener
Configure the package's listener to listen for SocialiteWasCalled events.
Add the event to your listen[] array in app/Providers/EventServiceProvider. See the Base Installation Guide for registration instructions for your Laravel version.
protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // ... other providers \SocialiteProviders\MinecraftEvoPixel\MinecraftEvoPixelExtendSocialite::class.'@handle', ], ];
Usage
You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed):
return Socialite::driver('mcevo')->redirect();
Retrieve the authenticated user in your callback:
$user = Socialite::driver('mcevo')->user();
Both routes must use session middleware. This provider uses state and S256 PKCE; keep the session between redirect and callback and do not use stateless() for this flow.
Handle rejected authorization, invalid state and failed API requests through your application's authentication error flow.
Returned User fields
idnicknamenameemailavatar
The email and avatar may be null. An email returned by the provider is not automatically verified. Use the provider and id to identify linked accounts.