Scope social login callbacks per flow
This commit is contained in:
@@ -35,6 +35,7 @@ class CheckoutFacebookController extends Controller
|
|||||||
$request->session()->put('selected_package_id', $payload['package_id']);
|
$request->session()->put('selected_package_id', $payload['package_id']);
|
||||||
|
|
||||||
return Socialite::driver('facebook')
|
return Socialite::driver('facebook')
|
||||||
|
->redirectUrl(route('checkout.facebook.callback'))
|
||||||
->scopes(['email'])
|
->scopes(['email'])
|
||||||
->fields(['name', 'email', 'first_name', 'last_name'])
|
->fields(['name', 'email', 'first_name', 'last_name'])
|
||||||
->redirect();
|
->redirect();
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class CheckoutGoogleController extends Controller
|
|||||||
$request->session()->put('selected_package_id', $payload['package_id']);
|
$request->session()->put('selected_package_id', $payload['package_id']);
|
||||||
|
|
||||||
return Socialite::driver('google')
|
return Socialite::driver('google')
|
||||||
|
->redirectUrl(route('checkout.google.callback'))
|
||||||
->scopes(['email', 'profile'])
|
->scopes(['email', 'profile'])
|
||||||
->with(['prompt' => 'select_account'])
|
->with(['prompt' => 'select_account'])
|
||||||
->redirect();
|
->redirect();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class TenantAdminFacebookController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Socialite::driver('facebook')
|
return Socialite::driver('facebook')
|
||||||
|
->redirectUrl(route('tenant.admin.facebook.callback'))
|
||||||
->scopes(['email'])
|
->scopes(['email'])
|
||||||
->fields(['name', 'email', 'first_name', 'last_name'])
|
->fields(['name', 'email', 'first_name', 'last_name'])
|
||||||
->redirect();
|
->redirect();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class TenantAdminGoogleController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Socialite::driver('google')
|
return Socialite::driver('google')
|
||||||
|
->redirectUrl(route('tenant.admin.google.callback'))
|
||||||
->scopes(['openid', 'profile', 'email'])
|
->scopes(['openid', 'profile', 'email'])
|
||||||
->with(['prompt' => 'select_account'])
|
->with(['prompt' => 'select_account'])
|
||||||
->redirect();
|
->redirect();
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class TenantAdminFacebookControllerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$driver = Mockery::mock();
|
$driver = Mockery::mock();
|
||||||
Socialite::shouldReceive('driver')->once()->with('facebook')->andReturn($driver);
|
Socialite::shouldReceive('driver')->once()->with('facebook')->andReturn($driver);
|
||||||
|
$driver->shouldReceive('redirectUrl')->once()->with(route('tenant.admin.facebook.callback'))->andReturnSelf();
|
||||||
$driver->shouldReceive('scopes')->once()->with(['email'])->andReturnSelf();
|
$driver->shouldReceive('scopes')->once()->with(['email'])->andReturnSelf();
|
||||||
$driver->shouldReceive('fields')->once()->with(['name', 'email', 'first_name', 'last_name'])->andReturnSelf();
|
$driver->shouldReceive('fields')->once()->with(['name', 'email', 'first_name', 'last_name'])->andReturnSelf();
|
||||||
$driver->shouldReceive('redirect')->once()->andReturn(new RedirectResponse('https://facebook.com/auth'));
|
$driver->shouldReceive('redirect')->once()->andReturn(new RedirectResponse('https://facebook.com/auth'));
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class TenantAdminGoogleControllerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$driver = Mockery::mock();
|
$driver = Mockery::mock();
|
||||||
Socialite::shouldReceive('driver')->once()->with('google')->andReturn($driver);
|
Socialite::shouldReceive('driver')->once()->with('google')->andReturn($driver);
|
||||||
|
$driver->shouldReceive('redirectUrl')->once()->with(route('tenant.admin.google.callback'))->andReturnSelf();
|
||||||
$driver->shouldReceive('scopes')->once()->with(['openid', 'profile', 'email'])->andReturnSelf();
|
$driver->shouldReceive('scopes')->once()->with(['openid', 'profile', 'email'])->andReturnSelf();
|
||||||
$driver->shouldReceive('with')->once()->with(['prompt' => 'select_account'])->andReturnSelf();
|
$driver->shouldReceive('with')->once()->with(['prompt' => 'select_account'])->andReturnSelf();
|
||||||
$driver->shouldReceive('redirect')->once()->andReturn(new RedirectResponse('https://accounts.google.com'));
|
$driver->shouldReceive('redirect')->once()->andReturn(new RedirectResponse('https://accounts.google.com'));
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class CheckoutFacebookControllerTest extends TestCase
|
|||||||
$package = Package::factory()->create();
|
$package = Package::factory()->create();
|
||||||
|
|
||||||
$provider = Mockery::mock(SocialiteProvider::class);
|
$provider = Mockery::mock(SocialiteProvider::class);
|
||||||
|
$provider->shouldReceive('redirectUrl')->with(route('checkout.facebook.callback'))->andReturnSelf();
|
||||||
$provider->shouldReceive('scopes')->andReturnSelf();
|
$provider->shouldReceive('scopes')->andReturnSelf();
|
||||||
$provider->shouldReceive('fields')->andReturnSelf();
|
$provider->shouldReceive('fields')->andReturnSelf();
|
||||||
$provider->shouldReceive('redirect')->once()->andReturn(redirect('/facebook/auth'));
|
$provider->shouldReceive('redirect')->once()->andReturn(redirect('/facebook/auth'));
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class CheckoutGoogleControllerTest extends TestCase
|
|||||||
$package = Package::factory()->create();
|
$package = Package::factory()->create();
|
||||||
|
|
||||||
$provider = Mockery::mock(SocialiteProvider::class);
|
$provider = Mockery::mock(SocialiteProvider::class);
|
||||||
|
$provider->shouldReceive('redirectUrl')->with(route('checkout.google.callback'))->andReturnSelf();
|
||||||
$provider->shouldReceive('scopes')->andReturnSelf();
|
$provider->shouldReceive('scopes')->andReturnSelf();
|
||||||
$provider->shouldReceive('with')->andReturnSelf();
|
$provider->shouldReceive('with')->andReturnSelf();
|
||||||
$provider->shouldReceive('redirect')->once()->andReturn(redirect('/google/auth'));
|
$provider->shouldReceive('redirect')->once()->andReturn(redirect('/google/auth'));
|
||||||
|
|||||||
Reference in New Issue
Block a user