Search by

catlabinteractive / laravel-catlab-accounts

catlab

Oauth-Openid client for the catlab authentication api for Ll

Package info

github.com/CatLabInteractive/laravel-catlab-accounts

pkg:composer/catlabinteractive/laravel-catlab-accounts

Statistics

Installs: 2 445

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v4.6.0 2026-12-01 13:53 UTC

README

Installation

  • Add to your app config providers:
   \CatLab\Accounts\Client\CatLabAccountsServiceProvider::class,
   \SocialiteProviders\Manager\ServiceProvider::class,
  • Add to aliases:
    'Socialite' => Laravel\Socialite\Facades\Socialite::class,
  • Add to your (web)routes:
\CatLab\Accounts\Client\Controllers\LoginController::setRoutes();
  • Add to EventServiceProvider
/**
 * The event listener mappings for the application.
 *
 * @var array
 */
protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        CatLabExtendSocialite::class
    ],
];

Mail with attachments

ApiClient::sendEmail takes a fifth parameter with the files to send:

$client->sendEmail($subject, $html, $target, $fromName, [
    [
        'filename' => 'grote-herfstquiz.ics',
        'contentType' => 'text/calendar',
        'content' => $calendar, // the raw file content
    ],
]);

The library does the base64 step and posts a JSON body. Accounts allows at most 3 attachments and 256 KB together, and only text/calendar with a filename that ends in .ics. For anything else accounts answers 400 and sends no mail, and Guzzle throws a ClientException. The caller decides whether to send the mail again without the file. A call without attachments sends the same form post as version 4.5.0.

Configuration

config/services.php reads these environment variables:

  • CATLAB_API: base url of the accounts server (default https://accounts.catlab.eu/).
  • CATLAB_CLIENT_ID / CATLAB_CLIENT_SECRET: the product's OAuth2 client credentials. Required. Besides the login flow they authenticate the product-level API calls in ApiClient (createOrder, sendEmail, getOrder, refundOrder, findOrCreateUser, cancelOrder), which use HTTP Basic client_id:client_secret instead of the user's access token. Accounts does not accept a user token on those routes, so ApiClient throws a LogicException when they are missing.