0

I have been following this trailhead to allow users login in a community using facebook:

https://trailhead.salesforce.com/en/modules/identity_external/units/identity_external_social

I dont want them to register, I only need they will be able to login. To get this I have modified the SF automatic handler.

global class SimpleFacebookRegistrationHandler implements Auth.RegistrationHandler{  

    global User createUser(Id portalId, Auth.UserData data){
        List<User> listUsers = [SELECT Id FROM User WHERE UserName = :data.email AND Profile.Name = :ProfileHelper.COMMUNITY_PROFILE LIMIT 1];
        if(listUsers.isEmpty()){
            return null;
        }else{
            return listUsers[0];
        }
    }

    global void updateUser(Id userId, Id portalId, Auth.UserData data){}

}

So then I go to the link provided by SF in the corresponding "Auth Providers" section, log in with FB and get the next error: "No access: User was a portal user"

What am I missing? Well, it is pretty obvious that the user was a portal user but if I can login using the "normal login" why I get this error being logged using facebook?

0

To others with same problem:

I just had to add

?community=COMMUNITY_URL_ENCODED 

to the link I was using (https://test.salesforce.com/services/auth/sso/.../Facebook) so at the end it worked visiting:

https://test.salesforce.com/services/auth/sso/.../Facebook?community=https%3A%2F%2examplecommunity.force.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.