Skip to content

owenvoke/socialite-unstoppable-domains

Repository files navigation

Unstoppable Domains Socialite Adapter

Latest Version on Packagist Software License Build Status Static Analysis Total Downloads Buy us a tree

An Unstoppable Domains provider for Laravel Socialite

Install

Via Composer

composer require owenvoke/socialite-unstoppable-domains

Please see the Base Installation Guide, then follow the provider specific instructions below.

Add configuration to config/services.php

'unstoppable_domains' => [    
    'client_id' => env('UNSTOPPABLE_DOMAINS_CLIENT_ID'),  
    'client_secret' => env('UNSTOPPABLE_DOMAINS_CLIENT_SECRET'),  
    'redirect' => env('UNSTOPPABLE_DOMAINS_REDIRECT_URI') 
],

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 detailed instructions.

protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        // ... other providers
        \OwenVoke\UnstoppableDomainsSocialite\UnstoppableDomainsExtendSocialite::class,
    ],
];

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('unstoppable_domains')->with(['login_hint' => $domain])->redirect();

Note, you are required to pass in the login_hint which is the domain that the user provided.

By default the email:optional scope is provided, if you want to require an email address to be returned, use the following:

return Socialite::driver('unstoppable_domains')
    ->scopes(['email']) // This will override the `email:optional` scope
    ->with(['login_hint' => $domain])
    ->redirect();

Returned User fields

  • id: The id (domain) of the authenticated user
  • token: The token of the authenticated user
  • email: The email address of the user (optional by default)
  • wallet_address: The wallet address of the user
  • user
    • sub: The domain of the authenticated user
    • wallet_address: The wallet address of the user
    • wallet_type_hint: The method of wallet authentication the user used
    • email: The email address of the user (optional by default)
    • email_verified: A boolean stating whether the user's email has been verified (optional by default)

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email security@voke.dev instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Treeware

You're free to use this package, but if it makes it to your production environment you are required to buy the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to plant trees. If you support this package and contribute to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees here.

Read more about Treeware at treeware.earth.