PHP code example of hello-one / laravel-socialite-provider
1. Go to this page and download the library: Download hello-one/laravel-socialite-provider library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hello-one / laravel-socialite-provider example snippets
/**
* 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;
}