thecoati / socialite-cfx-provider
Fund package maintenance!
TheCoati/
Installs: 3 666
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 2
Open Issues: 1
pkg:composer/thecoati/socialite-cfx-provider
Requires
- php: ^8.0.2
- ext-json: *
- ext-openssl: *
- laravel/socialite: ^5.5
- phpseclib/phpseclib: ^3.0
README
Cfx.re Laravel socialite adapter for authenticating with FiveM and RedM.
Table of Contents
Requirements
- Laravel 9+
Installation
- Install dependencies
composer require thecoati/socialite-cfx-provider. - Generate RSA public and private key
php artisan cfx:keys. - Add the following lines to your
.env:
CFX_APP_NAME=Laravel CFX_CLIENT_ID=UNIQUE_CLIENT_ID CFX_REDIRECT_URL=http://127.0.0.1:8000/callback CFX_AVATAR_SIZE=128
Alternatively, you can also publish the configuration file using php artisan vendor:publish --tag=cfx-config.
The CFX_APP_NAME is the application name listed at the apps page.
Make sure to generate a *random and unique CFX_CLIENT_ID you can generate this key yourself.
The CFX_AVATAR_SIZE determines the size at which the avatar is returned. Please note that values lower than 8 and higher than 1000 will result in a blank avatar. This is because Discourse has hardcoded these limits in their avatar controller.
Unless a real OAuth flow Discourse forums do not require any way of application registration.
Scopes
Available Discourse user API key scopes.
https://github.com/discourse/discourse/blob/main/app/models/user_api_key_scope.rb
readwritemessage_buspushone_time_passwordnotificationssession_info*Requiredbookmarks_calendar
Disclaimer
Unfortunately Discourse (community software used on forum.cfx.re) does not provide a full OAuth2 flow.
We modified the authentication flow of Socialite to match the authentication flow of Discourse.
Therefore It might be possible that Socialite features behave differently than expected.
Also note that there is no email scope available to obtain the users email.
For more information on the Discourse user API authentication see:
https://meta.discourse.org/t/user-api-keys-specification/48536