Laravel Socialite Provider for hello one
WORK IN PROGRESS - DO NOT USE IN PRODUCTION - WORK IN PROGRESS
Use your hello one guest list as a login provider for your Laravel App.
-
You can install this package via composer using the following command:
composer require hello-one/laravel-socialite-provider
The package will automatically register itself using package discovery.
-
Add your app as a OAuth Client on our dashboard.
As
Redirect Callback URL
we suggesthttps://{{yourLaravelApplication.com}}/hello-one/callback
Add the Client ID and Client Secret to your
.env
fileHELLO_ONE_SOCIALITE_CLIENT_ID={{ CLIENT_ID }} HELLO_ONE_SOCIALITE_CLIENT_SECRET={{ CLIENT_SECRET }} HELLO_ONE_SOCIALITE_CLIENT_REDIRECT={{ https://yourLaravelApplication.com/hello-one/callback }} HELLO_ONE_SOCIALITE_PROJECT_URL={{ https://your-hello-one-default-domain.com }}
Or publish the configuration
php artisan vendor:publish --tag 'hello-one-socialite'
and edit
config/hello-one-socialite.php
accordingly. -
Create your routes in
web.php
Route::get( 'hello-one/login', [ \App\Http\Controllers\Controller::class, 'redirectToProvider' ]); Route::get( 'hello-one/callback', [ \App\Http\Controllers\Controller::class, 'handleProviderCallback' ]);
-
Create your controller methods
/** * Redirect the user to the hello one login/authorization page. * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function redirectToProvider(\Illuminate\Http\Request $request) { return \Socialite::driver('hello-one-guest') ->stateless() ->scopes(['account:read']) ->redirect(); } /** * Obtain the user information from hello one. * * @return \Illuminate\Http\Response */ public function handleProviderCallback() { $user = \Socialite::driver('hello-one-guest') ->stateless() ->scopes(['account:read']) ->user(); echo 'Hi' . $user->email; }
-
Visit
https://{{yourLaravelApplication.com}}/hello-one/login
and you will be redirected to hello one to login/authorize.
Please notice our OAuth Documentation
Feel free to open a ticket, submit a Pull Request or ask our Support Team