| category | Payments |
|---|
composer require socialiteproviders/steadyPlease see the Base Installation Guide, then follow the provider specific instructions below.
Register an application in your Steady backend under Your Project Settings -> Integration -> API. Steady issues a client ID and client secret and lets you set the redirect URI, which must match the one configured below exactly.
'steady' => [
'client_id' => env('STEADY_CLIENT_ID'),
'client_secret' => env('STEADY_CLIENT_SECRET'),
'redirect' => env('STEADY_REDIRECT_URI')
],In Laravel 11, the default EventServiceProvider provider was removed. Instead, add the listener using the listen method on the Event facade, in your AppServiceProvider boot method.
- Note: You do not need to add anything for the built-in socialite providers unless you override them with your own providers.
Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
$event->extendSocialite('steady', \SocialiteProviders\Steady\Provider::class);
});Laravel 10 or below
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 detailed instructions.
protected $listen = [
\SocialiteProviders\Manager\SocialiteWasCalled::class => [
// ... other providers
\SocialiteProviders\Steady\SteadyExtendSocialite::class.'@handle',
],
];You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed):
return Socialite::driver('steady')->redirect();idnameemailavatarfirst_namelast_name
nickname is always null; Steady does not expose usernames.
Steady's whole purpose is memberships, so the provider exposes the subscription
the user holds for your publication. Pass the access token you already received
from user():
$user = Socialite::driver('steady')->user();
$subscription = Socialite::driver('steady')->getSubscriptionByToken($user->token);
$state = $subscription['attributes']['state'] ?? null; // e.g. "active"The method returns null when the user has no subscription. Useful attributes
include state, period, currency, monthly-amount, expires-at,
rss-feed-url, is-gift and shipping-address.
Steady access tokens expire after seven days, refresh tokens after a year, so
store $user->refreshToken alongside the access token and exchange it with
Socialite's built-in refresh:
$token = Socialite::driver('steady')->refreshToken($refreshToken);
$token->token; // the new access token
$token->refreshToken; // rotate the stored refresh token
$token->expiresIn;