working user authentication w/ fb and plain login
This commit is contained in:
@@ -15,7 +15,7 @@ hwi_oauth:
|
||||
type: facebook
|
||||
client_id: 320599508311862
|
||||
client_secret: 18d4f48cdd274bccee2678e5eff3f557
|
||||
scope: ""
|
||||
scope: "public_profile,email"
|
||||
options:
|
||||
display: popup
|
||||
auth_type: rerequest
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# HWIOAuthBundle routes
|
||||
hwi_oauth_redirect:
|
||||
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
|
||||
prefix: /connect
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
services:
|
||||
my.custom.user_provider:
|
||||
class: Jotunheimr\UserBundle\Security\Core\User\MyFOSUBUserProvider
|
||||
arguments: ['@fos_user.user_manager', { facebook: facebookId }]
|
||||
arguments: ['@fos_user.user_manager', { facebook: facebookId }, '@doctrine.orm.entity_manager']
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
xfbml : true,
|
||||
version : 'v2.8'
|
||||
});
|
||||
FB.AppEvents.logPageView();
|
||||
};
|
||||
|
||||
(function(d, s, id){
|
||||
@@ -24,16 +23,11 @@
|
||||
function fb_login() {
|
||||
FB.getLoginStatus(function(response) {
|
||||
if (response.status === 'connected') {
|
||||
// connected
|
||||
alert('Already connected, redirect to login page to create token.');
|
||||
document.location = "{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}";
|
||||
} else {
|
||||
// not_authorized
|
||||
FB.login(function(response) {
|
||||
if (response.authResponse) {
|
||||
document.location = "{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}";
|
||||
} else {
|
||||
alert('Cancelled.');
|
||||
}
|
||||
}, {scope: 'email'});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user