thecoati/socialite-cfx-provider

Fund package maintenance!
TheCoati/

v1.0.0 2022-11-30 09:59 UTC

This package is auto-updated.

Last update: 2024-05-25 02:42:13 UTC


README

Cfx.re Laravel socialite adapter for authenticating with FiveM and RedM.

Table of Contents

Requirements

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

  • read
  • write
  • message_bus
  • push
  • one_time_password
  • notifications
  • session_info *Required
  • bookmarks_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